Various small improvements, added test for instance annotations

This commit is contained in:
Francesco Chicchiriccò 2014-05-12 12:41:25 +02:00
parent c32f4a0bb1
commit 8720a30e21
20 changed files with 589 additions and 456 deletions

View File

@ -345,6 +345,17 @@ public class V4Services extends AbstractServices {
return new ByteArrayInputStream(bos.toByteArray());
}
@GET
@Path("/Boss")
public Response getSingletonBoss(
@Context UriInfo uriInfo,
@HeaderParam("Accept") @DefaultValue(StringUtils.EMPTY) String accept,
@QueryParam("$format") @DefaultValue(StringUtils.EMPTY) String format) {
return getEntityInternal(
uriInfo.getRequestUri().toASCIIString(), accept, "Boss", StringUtils.EMPTY, format, null, null, false);
}
@GET
@Path("/Company")
public Response getSingletonCompany(

View File

@ -125,6 +125,8 @@ public class DataBinder {
properties.add(toJSONProperty((AtomPropertyImpl) property));
}
jsonEntity.getAnnotations().addAll(atomEntity.getAnnotations());
return jsonEntity;
}

View File

@ -0,0 +1,46 @@
{
"@odata.context": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/$metadata#Boss",
"@odata.type": "#Microsoft.Test.OData.Services.ODataWCFService.Customer",
"@odata.id": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss",
"@odata.editLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer",
"@Microsoft.Test.OData.Services.ODataWCFService.IsBoss": true,
"PersonID": 2,
"FirstName": "Jill",
"LastName": "Jones",
"MiddleName": null,
"HomeAddress": null,
"Home@odata.type": "#GeographyPoint",
"Home": {
"type": "Point",
"coordinates": [161.8, 15.0],
"crs": {
"type": "name",
"properties": {
"name": "EPSG:4326"
}
}
},
"Numbers@odata.type": "#Collection(String)",
"Numbers": [],
"Emails@odata.type": "#Collection(String)",
"Emails": [],
"City": "Sydney",
"Birthday@odata.type": "#DateTimeOffset",
"Birthday": "1983-01-15T00:00:00Z",
"TimeBetweenLastTwoOrders@odata.type": "#Duration",
"TimeBetweenLastTwoOrders": "PT0.0000002S",
"Parent@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref",
"Parent@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent",
"Orders@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref",
"Orders@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders",
"Company@odata.associationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref",
"Company@odata.navigationLink": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company",
"#Microsoft.Test.OData.Services.ODataWCFService.ResetAddress": {
"title": "Microsoft.Test.OData.Services.ODataWCFService.ResetAddress",
"target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Microsoft.Test.OData.Services.ODataWCFService.ResetAddress"
},
"#Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress": {
"title": "Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress",
"target": "http://localhost:${cargo.servlet.port}/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Microsoft.Test.OData.Services.ODataWCFService.GetHomeAddress"
}
}

View File

@ -0,0 +1,51 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:d="http://docs.oasis-open.org/odata/ns/data" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss">
<id>http://localhost:9080/stub/StaticService/V40/Static.svc/Boss</id>
<category scheme="http://docs.oasis-open.org/odata/ns/scheme" term="#Microsoft.Test.OData.Services.ODataWCFService.Customer"/>
<link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Parent" title="Parent" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent/$ref" type="application/xml"/>
<link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Orders" title="Orders" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders/$ref" type="application/xml"/>
<link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/Company" title="Company" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company/$ref" type="application/xml"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Parent" title="Parent" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Parent" type="application/atom+xml;type=entry"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Orders" title="Orders" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Orders" type="application/atom+xml;type=entry"/>
<link rel="http://docs.oasis-open.org/odata/ns/related/Company" title="Company" href="http://localhost:9080/stub/StaticService/V40/Static.svc/Boss/Microsoft.Test.OData.Services.ODataWCFService.Customer/Company" type="application/atom+xml;type=entry"/>
<content type="application/xml">
<m:properties>
<d:PersonID m:type="Int32">2</d:PersonID>
<d:FirstName>Jill</d:FirstName>
<d:LastName>Jones</d:LastName>
<d:MiddleName m:null="true"/>
<d:HomeAddress m:null="true"/>
<d:Home m:type="GeographyPoint">
<gml:Point gml:srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
<gml:pos>161.8 15.0</gml:pos>
</gml:Point>
</d:Home>
<d:Numbers m:type="#Collection(String)"/>
<d:Emails m:type="#Collection(String)"/>
<d:City>Sydney</d:City>
<d:Birthday m:type="DateTimeOffset">1983-01-15T01:00:00+01:00</d:Birthday>
<d:TimeBetweenLastTwoOrders m:type="Duration">PT0.0000002S</d:TimeBetweenLastTwoOrders>
</m:properties>
</content>
<m:annotation term="Microsoft.Test.OData.Services.ODataWCFService.IsBoss" m:type="Boolean">true</m:annotation>
</entry>

View File

@ -1,35 +1,24 @@
{
"error": {
"code": "400",
"message": "Bad request.",
"target": "query",
"details": [
{
"code": "400",
"target": "$search" ,
"message": "Microsoft.Data.OData.BadRequest"
"code": "400",
"target": "$search",
"message": "Microsoft.Data.OData.BadRequest"
}
],
"innererror": {
"trace": ["at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings....","callmethod2 etc"],
"context": {"key1":"for debug deployment only"}
"trace": ["at Microsoft.Data.OData.MediaTypeUtils.GetContentTypeFromSettings....", "callmethod2 etc"],
"context": {
"key1": "for debug deployment only"
}
}
}
}

View File

@ -22,418 +22,441 @@
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:DataServices>
<Schema Namespace="Microsoft.Test.OData.Services.ODataWCFService" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Term Name="IsBoss" Type="Edm.Boolean"/>
<ComplexType Name="Address">
<Property Name="Street" Type="Edm.String" Nullable="false" />
<Property Name="City" Type="Edm.String" Nullable="false" />
<Property Name="PostalCode" Type="Edm.String" Nullable="false" />
<Property Name="Street" Type="Edm.String" Nullable="false"/>
<Property Name="City" Type="Edm.String" Nullable="false"/>
<Property Name="PostalCode" Type="Edm.String" Nullable="false"/>
</ComplexType>
<ComplexType Name="HomeAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
<Property Name="FamilyName" Type="Edm.String" />
<Property Name="FamilyName" Type="Edm.String"/>
</ComplexType>
<ComplexType Name="CompanyAddress" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Address">
<Property Name="CompanyName" Type="Edm.String" Nullable="false" />
<NavigationProperty Name="Contact" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="true" />
<Property Name="CompanyName" Type="Edm.String" Nullable="false"/>
</ComplexType>
<EnumType Name="AccessLevel" IsFlags="true">
<Member Name="None" Value="0" />
<Member Name="Read" Value="1" />
<Member Name="Write" Value="2" />
<Member Name="Execute" Value="4" />
<Member Name="ReadWrite" Value="3" />
<Member Name="None" Value="0"/>
<Member Name="Read" Value="1"/>
<Member Name="Write" Value="2"/>
<Member Name="Execute" Value="4"/>
<Member Name="ReadWrite" Value="3"/>
</EnumType>
<EnumType Name="Color">
<Member Name="Red" Value="1" />
<Member Name="Green" Value="2" />
<Member Name="Blue" Value="4" />
<Member Name="Red" Value="1"/>
<Member Name="Green" Value="2"/>
<Member Name="Blue" Value="4"/>
</EnumType>
<EnumType Name="CompanyCategory">
<Member Name="IT" Value="0" />
<Member Name="Communication" Value="1" />
<Member Name="Electronics" Value="2" />
<Member Name="Others" Value="4" />
<Member Name="IT" Value="0"/>
<Member Name="Communication" Value="1"/>
<Member Name="Electronics" Value="2"/>
<Member Name="Others" Value="4"/>
</EnumType>
<EntityType Name="Person">
<Key>
<PropertyRef Name="PersonID" />
<PropertyRef Name="PersonID"/>
</Key>
<Property Name="PersonID" Type="Edm.Int32" Nullable="false" />
<Property Name="FirstName" Type="Edm.String" Nullable="false" />
<Property Name="LastName" Type="Edm.String" Nullable="false" />
<Property Name="MiddleName" Type="Edm.String" />
<Property Name="HomeAddress" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" />
<Property Name="Home" Type="Edm.GeographyPoint" SRID="4326" />
<Property Name="Numbers" Type="Collection(Edm.String)" Nullable="false" />
<Property Name="Emails" Type="Collection(Edm.String)" />
<NavigationProperty Name="Parent" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
<Property Name="PersonID" Type="Edm.Int32" Nullable="false"/>
<Property Name="FirstName" Type="Edm.String" Nullable="false"/>
<Property Name="LastName" Type="Edm.String" Nullable="false"/>
<Property Name="MiddleName" Type="Edm.String"/>
<Property Name="HomeAddress" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
<Property Name="Home" Type="Edm.GeographyPoint" SRID="4326"/>
<Property Name="Numbers" Type="Collection(Edm.String)" Nullable="false"/>
<Property Name="Emails" Type="Collection(Edm.String)"/>
<NavigationProperty Name="Parent" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
</EntityType>
<EntityType Name="Customer" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
<Property Name="City" Type="Edm.String" Nullable="false" />
<Property Name="Birthday" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="TimeBetweenLastTwoOrders" Type="Edm.Duration" Nullable="false" />
<NavigationProperty Name="Orders" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Order)" />
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="VipCustomer" />
<Property Name="City" Type="Edm.String" Nullable="false"/>
<Property Name="Birthday" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="TimeBetweenLastTwoOrders" Type="Edm.Duration" Nullable="false"/>
<NavigationProperty Name="Orders" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Order)"/>
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="VipCustomer"/>
</EntityType>
<EntityType Name="Employee" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Person">
<Property Name="DateHired" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="Office" Type="Edm.GeographyPoint" SRID="4326" />
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Employees" />
<Property Name="DateHired" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="Office" Type="Edm.GeographyPoint" SRID="4326"/>
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Employees"/>
</EntityType>
<EntityType Name="Product">
<Key>
<PropertyRef Name="ProductID" />
<PropertyRef Name="ProductID"/>
</Key>
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
<Property Name="Name" Type="Edm.String" Nullable="false" />
<Property Name="QuantityPerUnit" Type="Edm.String" Nullable="false" />
<Property Name="UnitPrice" Type="Edm.Single" Nullable="false" />
<Property Name="QuantityInStock" Type="Edm.Int32" Nullable="false" />
<Property Name="Discontinued" Type="Edm.Boolean" Nullable="false" />
<Property Name="UserAccess" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
<Property Name="SkinColor" Type="Microsoft.Test.OData.Services.ODataWCFService.Color" />
<Property Name="CoverColors" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" Nullable="false" />
<Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String" Nullable="false"/>
<Property Name="QuantityPerUnit" Type="Edm.String" Nullable="false"/>
<Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
<Property Name="QuantityInStock" Type="Edm.Int32" Nullable="false"/>
<Property Name="Discontinued" Type="Edm.Boolean" Nullable="false"/>
<Property Name="UserAccess" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
<Property Name="SkinColor" Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
<Property Name="CoverColors" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Color)" Nullable="false"/>
<NavigationProperty Name="Details" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)">
<ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" />
<ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
</NavigationProperty>
</EntityType>
<EntityType Name="ProductDetail">
<Key>
<PropertyRef Name="ProductID" />
<PropertyRef Name="ProductDetailID" />
<PropertyRef Name="ProductID"/>
<PropertyRef Name="ProductDetailID"/>
</Key>
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
<Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false" />
<Property Name="ProductName" Type="Edm.String" Nullable="false" />
<Property Name="Description" Type="Edm.String" Nullable="false" />
<NavigationProperty Name="RelatedProduct" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" />
<Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ProductName" Type="Edm.String" Nullable="false"/>
<Property Name="Description" Type="Edm.String" Nullable="false"/>
<NavigationProperty Name="RelatedProduct" Type="Microsoft.Test.OData.Services.ODataWCFService.Product"/>
<NavigationProperty Name="Reviews" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductReview)">
<ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID" />
<ReferentialConstraint Property="ProductDetailID" ReferencedProperty="ProductDetailID" />
<ReferentialConstraint Property="ProductID" ReferencedProperty="ProductID"/>
<ReferentialConstraint Property="ProductDetailID" ReferencedProperty="ProductDetailID"/>
</NavigationProperty>
</EntityType>
<EntityType Name="ProductReview">
<Key>
<PropertyRef Name="ProductID" />
<PropertyRef Name="ProductDetailID" />
<PropertyRef Name="ReviewTitle" />
<PropertyRef Name="RevisionID" />
<PropertyRef Name="ProductID"/>
<PropertyRef Name="ProductDetailID"/>
<PropertyRef Name="ReviewTitle"/>
<PropertyRef Name="RevisionID"/>
</Key>
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
<Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false" />
<Property Name="ReviewTitle" Type="Edm.String" Nullable="false" />
<Property Name="RevisionID" Type="Edm.Int32" Nullable="false" />
<Property Name="Comment" Type="Edm.String" Nullable="false" />
<Property Name="Author" Type="Edm.String" Nullable="false" />
<Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ProductDetailID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ReviewTitle" Type="Edm.String" Nullable="false"/>
<Property Name="RevisionID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Comment" Type="Edm.String" Nullable="false"/>
<Property Name="Author" Type="Edm.String" Nullable="false"/>
</EntityType>
<EntityType Name="Order">
<Key>
<PropertyRef Name="OrderID" />
<PropertyRef Name="OrderID"/>
</Key>
<Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
<Property Name="OrderDate" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="ShelfLife" Type="Edm.Duration" />
<Property Name="OrderShelfLifes" Type="Collection(Edm.Duration)" />
<NavigationProperty Name="LoggedInEmployee" Type="Microsoft.Test.OData.Services.ODataWCFService.Employee" Nullable="false" />
<NavigationProperty Name="CustomerForOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" />
<NavigationProperty Name="OrderDetails" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.OrderDetail)" />
<Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
<Property Name="OrderDate" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="ShelfLife" Type="Edm.Duration"/>
<Property Name="OrderShelfLifes" Type="Collection(Edm.Duration)"/>
<NavigationProperty Name="LoggedInEmployee" Type="Microsoft.Test.OData.Services.ODataWCFService.Employee" Nullable="false"/>
<NavigationProperty Name="CustomerForOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false"/>
<NavigationProperty Name="OrderDetails" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.OrderDetail)"/>
</EntityType>
<EntityType Name="OrderDetail">
<Key>
<PropertyRef Name="OrderID" />
<PropertyRef Name="ProductID" />
<PropertyRef Name="OrderID"/>
<PropertyRef Name="ProductID"/>
</Key>
<Property Name="OrderID" Type="Edm.Int32" Nullable="false" />
<Property Name="ProductID" Type="Edm.Int32" Nullable="false" />
<Property Name="OrderPlaced" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="Quantity" Type="Edm.Int32" Nullable="false" />
<Property Name="UnitPrice" Type="Edm.Single" Nullable="false" />
<NavigationProperty Name="ProductOrdered" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" />
<NavigationProperty Name="AssociatedOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Order" Nullable="false" />
<Property Name="OrderID" Type="Edm.Int32" Nullable="false"/>
<Property Name="ProductID" Type="Edm.Int32" Nullable="false"/>
<Property Name="OrderPlaced" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="Quantity" Type="Edm.Int32" Nullable="false"/>
<Property Name="UnitPrice" Type="Edm.Single" Nullable="false"/>
<NavigationProperty Name="ProductOrdered" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)"/>
<NavigationProperty Name="AssociatedOrder" Type="Microsoft.Test.OData.Services.ODataWCFService.Order" Nullable="false"/>
</EntityType>
<EntityType Name="Department">
<Key>
<PropertyRef Name="DepartmentID" />
<PropertyRef Name="DepartmentID"/>
</Key>
<Property Name="DepartmentID" Type="Edm.Int32" Nullable="false" />
<Property Name="Name" Type="Edm.String" Nullable="false" />
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Departments" />
<Property Name="DepartmentID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String" Nullable="false"/>
<Property Name="DepartmentNO" Type="Edm.String"/>
<NavigationProperty Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" Partner="Departments"/>
</EntityType>
<EntityType Name="Company">
<EntityType Name="Company" OpenType="true">
<Key>
<PropertyRef Name="CompanyID" />
<PropertyRef Name="CompanyID"/>
</Key>
<Property Name="CompanyID" Type="Edm.Int32" Nullable="false" />
<Property Name="CompanyCategory" Type="Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory" />
<Property Name="Revenue" Type="Edm.Int64" Nullable="false" />
<Property Name="Name" Type="Edm.String" />
<Property Name="Address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" />
<NavigationProperty Name="Employees" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Employee)" Partner="Company" />
<NavigationProperty Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" Partner="Company" />
<NavigationProperty Name="Departments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Department)" Partner="Company" />
<NavigationProperty Name="CoreDepartment" Type="Microsoft.Test.OData.Services.ODataWCFService.Department" Nullable="false" />
<Property Name="CompanyID" Type="Edm.Int32" Nullable="false"/>
<Property Name="CompanyCategory" Type="Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory"/>
<Property Name="Revenue" Type="Edm.Int64" Nullable="false"/>
<Property Name="Name" Type="Edm.String"/>
<Property Name="Address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address"/>
<NavigationProperty Name="Employees" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Employee)" Partner="Company"/>
<NavigationProperty Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer" Nullable="false" Partner="Company"/>
<NavigationProperty Name="Departments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Department)" Partner="Company"/>
<NavigationProperty Name="CoreDepartment" Type="Microsoft.Test.OData.Services.ODataWCFService.Department" Nullable="false"/>
</EntityType>
<EntityType Name="PublicCompany" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Company">
<Property Name="StockExchange" Type="Edm.String" />
<NavigationProperty Name="Assets" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Asset)" ContainsTarget="true" />
<NavigationProperty Name="Club" Type="Microsoft.Test.OData.Services.ODataWCFService.Club" Nullable="false" ContainsTarget="true" />
<NavigationProperty Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" Nullable="false" />
<EntityType Name="PublicCompany" BaseType="Microsoft.Test.OData.Services.ODataWCFService.Company" OpenType="true">
<Property Name="StockExchange" Type="Edm.String"/>
<NavigationProperty Name="Assets" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Asset)" ContainsTarget="true"/>
<NavigationProperty Name="Club" Type="Microsoft.Test.OData.Services.ODataWCFService.Club" Nullable="false" ContainsTarget="true"/>
<NavigationProperty Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" Nullable="false"/>
</EntityType>
<EntityType Name="Asset">
<Key>
<PropertyRef Name="AssetID" />
<PropertyRef Name="AssetID"/>
</Key>
<Property Name="AssetID" Type="Edm.Int32" Nullable="false" />
<Property Name="Name" Type="Edm.String" />
<Property Name="Number" Type="Edm.Int32" Nullable="false" />
<Property Name="AssetID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String"/>
<Property Name="Number" Type="Edm.Int32" Nullable="false"/>
</EntityType>
<EntityType Name="Club">
<Key>
<PropertyRef Name="ClubID" />
<PropertyRef Name="ClubID"/>
</Key>
<Property Name="ClubID" Type="Edm.Int32" Nullable="false" />
<Property Name="Name" Type="Edm.String" />
<Property Name="ClubID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String"/>
</EntityType>
<EntityType Name="LabourUnion">
<Key>
<PropertyRef Name="LabourUnionID" />
<PropertyRef Name="LabourUnionID"/>
</Key>
<Property Name="LabourUnionID" Type="Edm.Int32" Nullable="false" />
<Property Name="Name" Type="Edm.String" />
<Property Name="LabourUnionID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String"/>
</EntityType>
<Action Name="AddAccessRight" IsBound="true">
<Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" />
<Parameter Name="accessRight" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
<Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
<Parameter Name="accessRight" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel"/>
</Action>
<Action Name="IncreaseRevenue" IsBound="true">
<Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" />
<Parameter Name="IncreaseValue" Type="Edm.Int64" />
<ReturnType Type="Edm.Int64" Nullable="false" />
<Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
<Parameter Name="IncreaseValue" Type="Edm.Int64"/>
<ReturnType Type="Edm.Int64" Nullable="false"/>
</Action>
<Action Name="ResetAddress" IsBound="true" EntitySetPath="person">
<Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
<Parameter Name="addresses" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)" Nullable="false" />
<Parameter Name="index" Type="Edm.Int32" Nullable="false" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
<Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
<Parameter Name="addresses" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Address)" Nullable="false"/>
<Parameter Name="index" Type="Edm.Int32" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
</Action>
<Action Name="Discount" IsBound="true" EntitySetPath="products">
<Parameter Name="products" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" />
<Parameter Name="percentage" Type="Edm.Int32" Nullable="false" />
<ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" />
<Parameter Name="products" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
<Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
<ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
</Action>
<Action Name="Discount">
<Parameter Name="percentage" Type="Edm.Int32" Nullable="false" />
<Parameter Name="percentage" Type="Edm.Int32" Nullable="false"/>
</Action>
<Action Name="ResetBossEmail">
<Parameter Name="emails" Type="Collection(Edm.String)" Nullable="false" />
<ReturnType Type="Collection(Edm.String)" Nullable="false" />
<Parameter Name="emails" Type="Collection(Edm.String)" Nullable="false"/>
<ReturnType Type="Collection(Edm.String)" Nullable="false"/>
</Action>
<Action Name="ResetBossAddress">
<Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" />
<Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
</Action>
<Action Name="ResetDataSource"/>
<Function Name="GetEmployeesCount" IsBound="true">
<Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false" />
<ReturnType Type="Edm.Int32" Nullable="false" />
<Parameter Name="p" Type="Microsoft.Test.OData.Services.ODataWCFService.Company" Nullable="false"/>
<ReturnType Type="Edm.Int32" Nullable="false"/>
</Function>
<Function Name="GetProductDetails" IsBound="true" EntitySetPath="product/Details" IsComposable="true">
<Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" />
<Parameter Name="count" Type="Edm.Int32" />
<ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)" Nullable="false" />
<Parameter Name="product" Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
<Parameter Name="count" Type="Edm.Int32"/>
<ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.ProductDetail)" Nullable="false"/>
</Function>
<Function Name="GetRelatedProduct" IsBound="true" EntitySetPath="productDetail/Products" IsComposable="true">
<Parameter Name="productDetail" Type="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" Nullable="false" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false" />
<Function Name="GetRelatedProduct" IsBound="true" EntitySetPath="productDetail/RelatedProduct" IsComposable="true">
<Parameter Name="productDetail" Type="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Product" Nullable="false"/>
</Function>
<Function Name="GetDefaultColor" IsComposable="true">
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Color" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Color"/>
</Function>
<Function Name="GetPerson" IsComposable="true">
<Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
<Parameter Name="address" Type="Microsoft.Test.OData.Services.ODataWCFService.Address" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
</Function>
<Function Name="GetPerson2" IsComposable="true">
<Parameter Name="city" Type="Edm.String" Nullable="false" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
<Parameter Name="city" Type="Edm.String" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
</Function>
<Function Name="GetAllProducts" IsComposable="true">
<ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false" />
<ReturnType Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Product)" Nullable="false"/>
</Function>
<Function Name="GetBossEmails">
<Parameter Name="start" Type="Edm.Int32" Nullable="false" />
<Parameter Name="count" Type="Edm.Int32" Nullable="false" />
<ReturnType Type="Collection(Edm.String)" Nullable="false" />
<Parameter Name="start" Type="Edm.Int32" Nullable="false"/>
<Parameter Name="count" Type="Edm.Int32" Nullable="false"/>
<ReturnType Type="Collection(Edm.String)" Nullable="false"/>
</Function>
<Function Name="GetProductsByAccessLevel">
<Parameter Name="accessLevel" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" />
<ReturnType Type="Collection(Edm.String)" Nullable="false" />
<Parameter Name="accessLevel" Type="Microsoft.Test.OData.Services.ODataWCFService.AccessLevel" Nullable="false"/>
<ReturnType Type="Collection(Edm.String)" Nullable="false"/>
</Function>
<Function Name="GetActualAmount" IsBound="true">
<Parameter Name="giftcard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" Nullable="false" />
<Parameter Name="bonusRate" Type="Edm.Double" />
<ReturnType Type="Edm.Double" Nullable="false" />
<Parameter Name="giftcard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" Nullable="false"/>
<Parameter Name="bonusRate" Type="Edm.Double"/>
<ReturnType Type="Edm.Double" Nullable="false"/>
</Function>
<Function Name="GetDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
<Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" />
<Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
</Function>
<Action Name="RefreshDefaultPI" IsBound="true" EntitySetPath="account/MyPaymentInstruments">
<Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" />
<Parameter Name="newDate" Type="Edm.DateTimeOffset" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument" />
<Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
<Parameter Name="newDate" Type="Edm.DateTimeOffset"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument"/>
</Action>
<Function Name="GetHomeAddress" IsBound="true" IsComposable="true">
<Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.HomeAddress" Nullable="false" />
<Parameter Name="person" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.HomeAddress" Nullable="false"/>
</Function>
<Function Name="GetAccountInfo" IsBound="true" IsComposable="true">
<Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false" />
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" Nullable="false" />
<Parameter Name="account" Type="Microsoft.Test.OData.Services.ODataWCFService.Account" Nullable="false"/>
<ReturnType Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" Nullable="false"/>
</Function>
<ComplexType Name="AccountInfo" OpenType="true">
<Property Name="FirstName" Type="Edm.String" Nullable="false" />
<Property Name="LastName" Type="Edm.String" Nullable="false" />
<Property Name="FirstName" Type="Edm.String" Nullable="false"/>
<Property Name="LastName" Type="Edm.String" Nullable="false"/>
</ComplexType>
<EntityType Name="Account">
<Key>
<PropertyRef Name="AccountID" />
<PropertyRef Name="AccountID"/>
</Key>
<Property Name="AccountID" Type="Edm.Int32" Nullable="false" />
<Property Name="Country" Type="Edm.String" Nullable="false" />
<Property Name="AccountInfo" Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo" />
<NavigationProperty Name="MyGiftCard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" ContainsTarget="true" />
<NavigationProperty Name="MyPaymentInstruments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument)" ContainsTarget="true" />
<NavigationProperty Name="ActiveSubscriptions" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" ContainsTarget="true" />
<NavigationProperty Name="AvailableSubscriptionTemplatess" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" />
<Property Name="AccountID" Type="Edm.Int32" Nullable="false"/>
<Property Name="Country" Type="Edm.String" Nullable="false"/>
<Property Name="AccountInfo" Type="Microsoft.Test.OData.Services.ODataWCFService.AccountInfo"/>
<NavigationProperty Name="MyGiftCard" Type="Microsoft.Test.OData.Services.ODataWCFService.GiftCard" ContainsTarget="true"/>
<NavigationProperty Name="MyPaymentInstruments" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument)" ContainsTarget="true"/>
<NavigationProperty Name="ActiveSubscriptions" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)" ContainsTarget="true"/>
<NavigationProperty Name="AvailableSubscriptionTemplatess" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Subscription)"/>
</EntityType>
<EntityType Name="GiftCard">
<Key>
<PropertyRef Name="GiftCardID" />
<PropertyRef Name="GiftCardID"/>
</Key>
<Property Name="GiftCardID" Type="Edm.Int32" Nullable="false" />
<Property Name="GiftCardNO" Type="Edm.String" Nullable="false" />
<Property Name="Amount" Type="Edm.Double" Nullable="false" />
<Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="GiftCardID" Type="Edm.Int32" Nullable="false"/>
<Property Name="GiftCardNO" Type="Edm.String" Nullable="false"/>
<Property Name="Amount" Type="Edm.Double" Nullable="false"/>
<Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
<Property Name="OwnerName" Type="Edm.String"/>
</EntityType>
<EntityType Name="PaymentInstrument">
<Key>
<PropertyRef Name="PaymentInstrumentID" />
<PropertyRef Name="PaymentInstrumentID"/>
</Key>
<Property Name="PaymentInstrumentID" Type="Edm.Int32" Nullable="false" />
<Property Name="FriendlyName" Type="Edm.String" Nullable="false" />
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
<NavigationProperty Name="TheStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false" />
<NavigationProperty Name="BillingStatements" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Statement)" ContainsTarget="true" />
<NavigationProperty Name="BackupStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false" />
<Property Name="PaymentInstrumentID" Type="Edm.Int32" Nullable="false"/>
<Property Name="FriendlyName" Type="Edm.String" Nullable="false"/>
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
<NavigationProperty Name="TheStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
<NavigationProperty Name="BillingStatements" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.Statement)" ContainsTarget="true"/>
<NavigationProperty Name="BackupStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" Nullable="false"/>
</EntityType>
<EntityType Name="CreditCardPI" BaseType="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument">
<Property Name="CardNumber" Type="Edm.String" Nullable="false" />
<Property Name="CVV" Type="Edm.String" Nullable="false" />
<Property Name="HolderName" Type="Edm.String" Nullable="false" />
<Property Name="Balance" Type="Edm.Double" Nullable="false" />
<Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false" />
<NavigationProperty Name="CreditRecords" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.CreditRecord)" ContainsTarget="true" />
<Property Name="CardNumber" Type="Edm.String" Nullable="false"/>
<Property Name="CVV" Type="Edm.String" Nullable="false"/>
<Property Name="HolderName" Type="Edm.String" Nullable="false"/>
<Property Name="Balance" Type="Edm.Double" Nullable="false"/>
<Property Name="ExperationDate" Type="Edm.DateTimeOffset" Nullable="false"/>
<NavigationProperty Name="CreditRecords" Type="Collection(Microsoft.Test.OData.Services.ODataWCFService.CreditRecord)" ContainsTarget="true"/>
</EntityType>
<EntityType Name="StoredPI">
<Key>
<PropertyRef Name="StoredPIID" />
<PropertyRef Name="StoredPIID"/>
</Key>
<Property Name="StoredPIID" Type="Edm.Int32" Nullable="false" />
<Property Name="PIName" Type="Edm.String" Nullable="false" />
<Property Name="PIType" Type="Edm.String" Nullable="false" />
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="StoredPIID" Type="Edm.Int32" Nullable="false"/>
<Property Name="PIName" Type="Edm.String" Nullable="false"/>
<Property Name="PIType" Type="Edm.String" Nullable="false"/>
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
</EntityType>
<EntityType Name="Statement">
<Key>
<PropertyRef Name="StatementID" />
<PropertyRef Name="StatementID"/>
</Key>
<Property Name="StatementID" Type="Edm.Int32" Nullable="false" />
<Property Name="TransactionType" Type="Edm.String" Nullable="false" />
<Property Name="TransactionDescription" Type="Edm.String" Nullable="false" />
<Property Name="Amount" Type="Edm.Double" Nullable="false" />
<Property Name="StatementID" Type="Edm.Int32" Nullable="false"/>
<Property Name="TransactionType" Type="Edm.String" Nullable="false"/>
<Property Name="TransactionDescription" Type="Edm.String" Nullable="false"/>
<Property Name="Amount" Type="Edm.Double" Nullable="false"/>
</EntityType>
<EntityType Name="CreditRecord">
<Key>
<PropertyRef Name="CreditRecordID" />
<PropertyRef Name="CreditRecordID"/>
</Key>
<Property Name="CreditRecordID" Type="Edm.Int32" Nullable="false" />
<Property Name="IsGood" Type="Edm.Boolean" Nullable="false" />
<Property Name="Reason" Type="Edm.String" Nullable="false" />
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="CreditRecordID" Type="Edm.Int32" Nullable="false"/>
<Property Name="IsGood" Type="Edm.Boolean" Nullable="false"/>
<Property Name="Reason" Type="Edm.String" Nullable="false"/>
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
</EntityType>
<EntityType Name="Subscription">
<Key>
<PropertyRef Name="SubscriptionID" />
<PropertyRef Name="SubscriptionID"/>
</Key>
<Property Name="SubscriptionID" Type="Edm.Int32" Nullable="false" />
<Property Name="TemplateGuid" Type="Edm.String" Nullable="false" />
<Property Name="Title" Type="Edm.String" Nullable="false" />
<Property Name="Category" Type="Edm.String" Nullable="false" />
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false" />
<Property Name="SubscriptionID" Type="Edm.Int32" Nullable="false"/>
<Property Name="TemplateGuid" Type="Edm.String" Nullable="false"/>
<Property Name="Title" Type="Edm.String" Nullable="false"/>
<Property Name="Category" Type="Edm.String" Nullable="false"/>
<Property Name="CreatedDate" Type="Edm.DateTimeOffset" Nullable="false"/>
</EntityType>
<EntityContainer Name="InMemoryEntities">
<EntitySet Name="People" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Person">
<NavigationPropertyBinding Path="Parent" Target="People" />
<NavigationPropertyBinding Path="Parent" Target="People"/>
</EntitySet>
<Singleton Name="Boss" Type="Microsoft.Test.OData.Services.ODataWCFService.Person" />
<Singleton Name="Boss" Type="Microsoft.Test.OData.Services.ODataWCFService.Person">
<NavigationPropertyBinding Path="Parent" Target="People"/>
</Singleton>
<EntitySet Name="Customers" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Customer">
<NavigationPropertyBinding Path="Orders" Target="Orders" />
<NavigationPropertyBinding Path="Orders" Target="Orders"/>
<NavigationPropertyBinding Path="Parent" Target="People"/>
</EntitySet>
<Singleton Name="VipCustomer" Type="Microsoft.Test.OData.Services.ODataWCFService.Customer">
<NavigationPropertyBinding Path="Orders" Target="Orders" />
<NavigationPropertyBinding Path="Company" Target="Company" />
<NavigationPropertyBinding Path="Orders" Target="Orders"/>
<NavigationPropertyBinding Path="Parent" Target="People"/>
<NavigationPropertyBinding Path="Company" Target="Company"/>
</Singleton>
<EntitySet Name="Employees" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Employee">
<NavigationPropertyBinding Path="Company" Target="Company" />
<NavigationPropertyBinding Path="Parent" Target="People"/>
<NavigationPropertyBinding Path="Company" Target="Company"/>
</EntitySet>
<EntitySet Name="Products" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Product">
<NavigationPropertyBinding Path="Details" Target="ProductDetails" />
<NavigationPropertyBinding Path="Details" Target="ProductDetails"/>
</EntitySet>
<EntitySet Name="ProductDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductDetail">
<NavigationPropertyBinding Path="RelatedProduct" Target="Products" />
<NavigationPropertyBinding Path="Reviews" Target="ProductReviews" />
<NavigationPropertyBinding Path="RelatedProduct" Target="Products"/>
<NavigationPropertyBinding Path="Reviews" Target="ProductReviews"/>
</EntitySet>
<EntitySet Name="ProductReviews" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductReview" />
<EntitySet Name="ProductReviews" EntityType="Microsoft.Test.OData.Services.ODataWCFService.ProductReview"/>
<EntitySet Name="Orders" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Order">
<NavigationPropertyBinding Path="LoggedInEmployee" Target="Employees" />
<NavigationPropertyBinding Path="CustomerForOrder" Target="Customers" />
<NavigationPropertyBinding Path="OrderDetails" Target="OrderDetails" />
<NavigationPropertyBinding Path="LoggedInEmployee" Target="Employees"/>
<NavigationPropertyBinding Path="CustomerForOrder" Target="Customers"/>
<NavigationPropertyBinding Path="OrderDetails" Target="OrderDetails"/>
<Annotation Term="Core.ChangeTracking">
<Record>
<PropertyValue Property="Supported" Bool="true"/>
<PropertyValue Property="FilterableProperties">
<Collection>
<PropertyPath>OrderID</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="ExpandableProperties">
<Collection>
<PropertyPath>OrderDetails</PropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</EntitySet>
<EntitySet Name="OrderDetails" EntityType="Microsoft.Test.OData.Services.ODataWCFService.OrderDetail">
<NavigationPropertyBinding Path="AssociatedOrder" Target="Orders" />
<NavigationPropertyBinding Path="ProductOrdered" Target="Products" />
<NavigationPropertyBinding Path="AssociatedOrder" Target="Orders"/>
<NavigationPropertyBinding Path="ProductOrdered" Target="Products"/>
</EntitySet>
<EntitySet Name="Departments" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Department">
<NavigationPropertyBinding Path="Company" Target="Company" />
<NavigationPropertyBinding Path="Company" Target="Company"/>
</EntitySet>
<Singleton Name="Company" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
<NavigationPropertyBinding Path="Employees" Target="Employees" />
<NavigationPropertyBinding Path="VipCustomer" Target="VipCustomer" />
<NavigationPropertyBinding Path="Departments" Target="Departments" />
<NavigationPropertyBinding Path="CoreDepartment" Target="Departments" />
<NavigationPropertyBinding Path="Employees" Target="Employees"/>
<NavigationPropertyBinding Path="VipCustomer" Target="VipCustomer"/>
<NavigationPropertyBinding Path="Departments" Target="Departments"/>
<NavigationPropertyBinding Path="CoreDepartment" Target="Departments"/>
</Singleton>
<Singleton Name="PublicCompany" Type="Microsoft.Test.OData.Services.ODataWCFService.Company">
<NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PublicCompany/LabourUnion" Target="LabourUnion" />
<NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PublicCompany/LabourUnion" Target="LabourUnion"/>
</Singleton>
<Singleton Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion" />
<ActionImport Name="Discount" Action="Microsoft.Test.OData.Services.ODataWCFService.Discount" />
<ActionImport Name="ResetBossEmail" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossEmail" />
<ActionImport Name="ResetBossAddress" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossAddress" />
<FunctionImport Name="GetDefaultColor" Function="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultColor" />
<FunctionImport Name="GetPerson" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson" EntitySet="People" />
<FunctionImport Name="GetPerson2" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson2" EntitySet="People" />
<FunctionImport Name="GetAllProducts" Function="Microsoft.Test.OData.Services.ODataWCFService.GetAllProducts" EntitySet="Products" />
<FunctionImport Name="GetBossEmails" Function="Microsoft.Test.OData.Services.ODataWCFService.GetBossEmails" />
<FunctionImport Name="GetProductsByAccessLevel" Function="Microsoft.Test.OData.Services.ODataWCFService.GetProductsByAccessLevel" />
<Singleton Name="LabourUnion" Type="Microsoft.Test.OData.Services.ODataWCFService.LabourUnion"/>
<ActionImport Name="Discount" Action="Microsoft.Test.OData.Services.ODataWCFService.Discount"/>
<ActionImport Name="ResetBossEmail" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossEmail"/>
<ActionImport Name="ResetBossAddress" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetBossAddress"/>
<ActionImport Name="ResetDataSource" Action="Microsoft.Test.OData.Services.ODataWCFService.ResetDataSource"/>
<FunctionImport Name="GetDefaultColor" Function="Microsoft.Test.OData.Services.ODataWCFService.GetDefaultColor" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetPerson" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson" EntitySet="People" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetPerson2" Function="Microsoft.Test.OData.Services.ODataWCFService.GetPerson2" EntitySet="People" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetAllProducts" Function="Microsoft.Test.OData.Services.ODataWCFService.GetAllProducts" EntitySet="Products" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetBossEmails" Function="Microsoft.Test.OData.Services.ODataWCFService.GetBossEmails" IncludeInServiceDocument="true"/>
<FunctionImport Name="GetProductsByAccessLevel" Function="Microsoft.Test.OData.Services.ODataWCFService.GetProductsByAccessLevel" IncludeInServiceDocument="true"/>
<EntitySet Name="Accounts" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Account">
<NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/TheStoredPI" Target="StoredPIs" />
<NavigationPropertyBinding Path="AvailableSubscriptionTemplatess" Target="SubscriptionTemplates" />
<NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/BackupStoredPI" Target="DefaultStoredPI" />
<NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/TheStoredPI" Target="StoredPIs"/>
<NavigationPropertyBinding Path="AvailableSubscriptionTemplatess" Target="SubscriptionTemplates"/>
<NavigationPropertyBinding Path="Microsoft.Test.OData.Services.ODataWCFService.PaymentInstrument/BackupStoredPI" Target="DefaultStoredPI"/>
</EntitySet>
<EntitySet Name="StoredPIs" EntityType="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" />
<EntitySet Name="SubscriptionTemplates" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Subscription" />
<Singleton Name="DefaultStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI" />
<EntitySet Name="StoredPIs" EntityType="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
<EntitySet Name="SubscriptionTemplates" EntityType="Microsoft.Test.OData.Services.ODataWCFService.Subscription"/>
<Singleton Name="DefaultStoredPI" Type="Microsoft.Test.OData.Services.ODataWCFService.StoredPI"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
</edmx:Edmx>

View File

@ -1,35 +1,23 @@
{
"error": {
"code": "501",
"message": "Unsupported functionality",
"target": "query",
"details": [
{
"code": "301",
"target": "$search",
"message": "$search query option not supported"
"code": "301",
"target": "$search",
"message": "$search query option not supported"
}
],
"innererror": {
"trace": ["callmethod1 etc","callmethod2 etc"],
"context": {"key1":"for debug deployment only"}
"trace": ["callmethod1 etc", "callmethod2 etc"],
"context": {
"key1": "for debug deployment only"
}
}
}
}

View File

@ -19,11 +19,10 @@
package org.apache.olingo.fit.v4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
import java.net.URI;
import java.util.Dictionary;
import java.util.Map;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.commons.api.domain.ODataError;
@ -34,43 +33,33 @@ import org.junit.Test;
public class ErrorResponseTestITCase extends AbstractTestITCase {
@Test
public void jsonError() {
@Test
public void jsonError() {
final URI readURI = getClient().getURIBuilder(testStaticServiceRootURL).
appendEntitySetSegment("Customers").appendKeySegment(32).
build();
ODataPubFormat format = ODataPubFormat.JSON;
final URI readURI = getClient().getURIBuilder(testStaticServiceRootURL)
.appendEntitySetSegment("Customers").appendKeySegment(32)
.build();
final ODataEntityRequest<ODataEntity> req = getClient().getRetrieveRequestFactory().getEntityRequest(readURI);
try {
final ODataEntity read = read(ODataPubFormat.JSON, readURI);
final ODataEntityRequest<ODataEntity> req = getClient()
.getRetrieveRequestFactory().getEntityRequest(readURI);
try {
final ODataEntity read = read(format, readURI);
} catch (Exception ex) {
ODataError err = ((ODataClientErrorException) ex).getODataError();
fail("should have got exception");
} catch (Exception ex) {
final ODataError err = ((ODataClientErrorException) ex).getODataError();
// verify details
ODataErrorDetail detail = (ODataErrorDetail) err.getDetails()
.get(0);
assertEquals("Code should be correct", "301", detail.getCode());
assertEquals("Target should be correct", "$search",
detail.getTarget());
assertEquals("Message should be correct",
"$search query option not supported", detail.getMessage());
// verify details
final ODataErrorDetail detail = (ODataErrorDetail) err.getDetails().get(0);
assertEquals("Code should be correct", "301", detail.getCode());
assertEquals("Target should be correct", "$search", detail.getTarget());
assertEquals("Message should be correct", "$search query option not supported", detail.getMessage());
// verify inner error dictionary
Dictionary<String, Object> innerErr = err.getInnerError();
assertEquals("innerError dictionary size should be correct", 2,
innerErr.size());
assertEquals("innerError['context'] should be correct",
"{\"key1\":\"for debug deployment only\"}",
innerErr.get("context"));
assertEquals("innerError['trace'] should be correct",
"[\"callmethod1 etc\",\"callmethod2 etc\"]",
innerErr.get("trace"));
return;
}
assertNotNull("should have got exception", null);
}
// verify inner error dictionary
final Map<String, String> innerErr = err.getInnerError();
assertEquals("innerError dictionary size should be correct", 2, innerErr.size());
assertEquals("innerError['context'] should be correct",
"{\"key1\":\"for debug deployment only\"}", innerErr.get("context"));
assertEquals("innerError['trace'] should be correct",
"[\"callmethod1 etc\",\"callmethod2 etc\"]", innerErr.get("trace"));
}
}
}

View File

@ -20,6 +20,7 @@ package org.apache.olingo.fit.v4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.apache.olingo.commons.api.edm.Edm;
@ -28,35 +29,56 @@ import org.apache.olingo.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.commons.api.edm.EdmEntitySet;
import org.apache.olingo.commons.api.edm.EdmEntityType;
import org.apache.olingo.commons.api.edm.EdmEnumType;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.apache.olingo.commons.api.edm.EdmSchema;
import org.apache.olingo.commons.api.edm.EdmTerm;
import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.edm.annotation.EdmRecord;
import org.apache.olingo.commons.core.edm.primitivetype.EdmBoolean;
import org.junit.Test;
public class MetadataTestITCase extends AbstractTestITCase {
@Test
public void retrieve() {
final Edm metadata = client.getRetrieveRequestFactory().
getMetadataRequest(testStaticServiceRootURL).execute().getBody();
assertNotNull(metadata);
public void retrieve() throws EdmPrimitiveTypeException {
final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testStaticServiceRootURL).execute().getBody();
assertNotNull(edm);
final EdmEntityType order = metadata.getEntityType(
final EdmEntityType order = edm.getEntityType(
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService", "Order"));
assertNotNull(order);
final EdmProperty orderDate = order.getStructuralProperty("OrderDate");
assertNotNull(orderDate);
assertEquals("Edm.DateTimeOffset", orderDate.getType().getFullQualifiedName().toString());
final EdmTerm isBoss = edm.getTerm(new FullQualifiedName(edm.getSchemas().get(0).getNamespace(), "IsBoss"));
assertNotNull(isBoss);
assertEquals(EdmBoolean.getInstance(), isBoss.getType());
final EdmEntitySet orders = edm.getSchemas().get(0).getEntityContainer().getEntitySet("Orders");
assertNotNull(orders);
assertFalse(orders.getAnnotations().isEmpty());
assertTrue(orders.getAnnotations().get(0).getExpression().isDynamic());
assertTrue(orders.getAnnotations().get(0).getExpression().asDynamic().isRecord());
final EdmRecord record = orders.getAnnotations().get(0).getExpression().asDynamic().asRecord();
assertNotNull(record);
assertEquals(3, record.getPropertyValues().size());
assertTrue(record.getPropertyValues().get(0).getValue().isConstant());
assertTrue(record.getPropertyValues().get(0).getValue().asConstant().getValue().asPrimitive().
toCastValue(Boolean.class));
assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().isCollection());
assertEquals(1, record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().size());
assertTrue(record.getPropertyValues().get(1).getValue().asDynamic().asCollection().getItems().get(0).isDynamic());
assertEquals("OrderID", record.getPropertyValues().get(1).getValue().asDynamic().asCollection().
getItems().get(0).asDynamic().asPropertyPath().getValue());
}
@Test
public void include() {
final Edm edm = client.getRetrieveRequestFactory().
getMetadataRequest(testNorthwindRootURL).execute().getBody();
final Edm edm = client.getRetrieveRequestFactory().getMetadataRequest(testNorthwindRootURL).execute().getBody();
assertNotNull(edm);
final EdmEntityContainer container = edm.getEntityContainer(

View File

@ -20,6 +20,7 @@ package org.apache.olingo.fit.v4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.net.URI;
@ -29,6 +30,7 @@ import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRe
import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.client.api.v4.ODataClient;
import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
import org.apache.olingo.commons.api.domain.v4.ODataValuable;
import org.apache.olingo.commons.api.domain.v4.Singleton;
import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
@ -55,12 +57,12 @@ public class SingletonTestITCase extends AbstractTestITCase {
}
@Test
public void readfromAtom() throws EdmPrimitiveTypeException {
public void readFromAtom() throws EdmPrimitiveTypeException {
read(client, ODataPubFormat.ATOM);
}
@Test
public void readfromJSON() throws EdmPrimitiveTypeException {
public void readFromJSON() throws EdmPrimitiveTypeException {
read(edmClient, ODataPubFormat.JSON);
}
@ -69,6 +71,37 @@ public class SingletonTestITCase extends AbstractTestITCase {
read(client, ODataPubFormat.JSON_FULL_METADATA);
}
private void readWithAnnotations(final ODataClient client, final ODataPubFormat format)
throws EdmPrimitiveTypeException {
final URIBuilder builder = client.getURIBuilder(testStaticServiceRootURL).appendSingletonSegment("Boss");
final ODataEntityRequest<Singleton> singleton =
client.getRetrieveRequestFactory().getSingletonRequest(builder.build());
singleton.setFormat(format);
singleton.setPrefer(client.newPreferences().includeAnnotations("*"));
final Singleton boss = singleton.execute().getBody();
assertNotNull(boss);
assertFalse(boss.getAnnotations().isEmpty());
final ODataAnnotation isBoss = boss.getAnnotations().get(0);
assertTrue(isBoss.getPrimitiveValue().toCastValue(Boolean.class));
}
@Test
public void readWithAnnotationsFromAtom() throws EdmPrimitiveTypeException {
readWithAnnotations(client, ODataPubFormat.ATOM);
}
@Test
public void readWithAnnotationsFromJSON() throws EdmPrimitiveTypeException {
readWithAnnotations(edmClient, ODataPubFormat.JSON);
}
@Test
public void readWithAnnotationsFromJSONFull() throws EdmPrimitiveTypeException {
readWithAnnotations(client, ODataPubFormat.JSON_FULL_METADATA);
}
private void update(final ODataPubFormat format) throws EdmPrimitiveTypeException {
final Singleton changes = getClient().getObjectFactory().newSingleton(
new FullQualifiedName("Microsoft.Test.OData.Services.ODataWCFService.Company"));

View File

@ -32,14 +32,16 @@ public class EdmRecordImpl extends AbstractEdmAnnotatableDynamicAnnotationExpres
private final List<EdmPropertyValue> propertyValues;
private final EdmStructuredType type;
private EdmStructuredType type;
public EdmRecordImpl(final Edm edm, final String type, final List<EdmPropertyValue> propertyValues) {
this.edm = edm;
this.propertyValues = propertyValues;
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(type).build();
this.type = typeInfo.getEntityType() == null ? typeInfo.getComplexType() : typeInfo.getEntityType();
if (type != null) {
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(type).build();
this.type = typeInfo.getEntityType() == null ? typeInfo.getComplexType() : typeInfo.getEntityType();
}
}
@Override

View File

@ -145,6 +145,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
final Annotation annotation = new AnnotationImpl();
annotation.setTerm(odataAnnotation.getTerm());
annotation.setType(odataAnnotation.getValue().getTypeName());
updateValuable(annotation, odataAnnotation, reference);
annotatable.getAnnotations().add(annotation);
@ -230,8 +231,16 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
}
}
if (fqn == null && annotation.getType() != null) {
final EdmTypeInfo typeInfo = new EdmTypeInfo.Builder().setTypeExpression(annotation.getType()).build();
if (typeInfo.isPrimitiveType()) {
fqn = typeInfo.getPrimitiveTypeKind().getFullQualifiedName();
}
}
final ODataAnnotation odataAnnotation = new ODataAnnotationImpl(annotation.getTerm(),
(org.apache.olingo.commons.api.domain.v4.ODataValue) getODataValue(fqn, annotation, null, null));
odataAnnotatable.getAnnotations().add(odataAnnotation);
}
}
@ -278,7 +287,7 @@ public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder
final ODataProperty property = new ODataPropertyImpl(resource.getPayload().getName(),
getODataValue(typeInfo == null ? null : typeInfo.getFullQualifiedName(),
resource.getPayload(), resource.getContextURL(), resource.getMetadataETag()));
resource.getPayload(), resource.getContextURL(), resource.getMetadataETag()));
odataAnnotations(resource.getPayload(), property);
return property;

View File

@ -246,8 +246,8 @@ public interface Constants {
public static final String ERROR_TARGET = "target";
public static final String ERROR_DETAILS = "details";
public static final String ERROR_INNERERROR= "innererror";
public static final String ERROR_INNERERROR = "innererror";
// canonical functions to be applied via dynamic annotation <tt>Apply</tt>
public static final String CANONICAL_FUNCTION_CONCAT = "odata.concat";

View File

@ -18,8 +18,8 @@
*/
package org.apache.olingo.commons.api.domain;
import java.util.Dictionary;
import java.util.List;
import java.util.Map;
/**
* OData error.
@ -46,7 +46,6 @@ public interface ODataError {
* @return error message.
*/
String getTarget();
/**
* Gets error details.
@ -58,7 +57,7 @@ public interface ODataError {
/**
* Gets server defined key-value pairs for debug environment only.
*
* @return a Dictionary representing server defined object.
* @return a pair representing server defined object.
*/
Dictionary<String, Object> getInnerError();
Map<String, String> getInnerError();
}

View File

@ -19,9 +19,9 @@
package org.apache.olingo.commons.api.domain;
/**
* OData details for example - { "error": {..., "details":[
* OData details for example <tt>{ "error": {..., "details":[
* {"code": "301","target": "$search" ,"message": "$search query option not supported"}
* ],...}}
* ],...}}</tt>.
*/
public interface ODataErrorDetail {

View File

@ -209,7 +209,7 @@ abstract class AbstractJsonSerializer<T> extends ODataJacksonSerializer<T> {
}
protected void valuable(final JsonGenerator jgen, final Valuable valuable, final String name) throws IOException {
if (serverMode && !Constants.VALUE.equals(name)) {
if (serverMode && !Constants.VALUE.equals(name) && !(valuable instanceof Annotation)) {
String type = valuable.getType();
if (StringUtils.isBlank(type) && valuable.getValue().isPrimitive() || valuable.getValue().isNull()) {
type = EdmPrimitiveTypeKind.String.getFullQualifiedName().toString();

View File

@ -18,30 +18,22 @@
*/
package org.apache.olingo.commons.core.data;
import java.util.Dictionary;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.olingo.commons.api.domain.ODataError;
import org.apache.olingo.commons.api.domain.ODataErrorDetail;
// {
// "error": {
// "code": "501",
// "message": "Unsupported functionality",
// "target": "query",
// "details": [
// {
// "code": "301",
// "target": "$search",
// "message": "$search query option not supported"
// }
// ],
// "innererror": {
// "trace": [...],
// "context": {...}
// }
// }
// }
/**
* Example:
* <tt>
* {
* "error": { "code": "501", "message": "Unsupported functionality", "target": "query", "details": [ { "code": "301",
* "target": "$search", "message": "$search query option not supported" } ], "innererror": { "trace": [...], "context":
* {...} } } }
* </tt>.
*/
public abstract class AbstractODataError implements ODataError {
private String code;
@ -51,9 +43,9 @@ public abstract class AbstractODataError implements ODataError {
private String target;
private List<ODataErrorDetail> details;
private Dictionary<String,Object> innerError;
private Map<String, String> innerError = new LinkedHashMap<String, String>();
@Override
public String getCode() {
return code;
@ -91,11 +83,7 @@ public abstract class AbstractODataError implements ODataError {
}
@Override
public Dictionary<String,Object> getInnerError() {
public Map<String, String> getInnerError() {
return innerError;
}
public void setInnerError(final Dictionary<String,Object> innerError) {
this.innerError = innerError;
}
}

View File

@ -24,17 +24,12 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.domain.ODataErrorDetail;
@ -65,29 +60,25 @@ public class JSONODataErrorDeserializer extends AbstractJsonDeserializer<JSONODa
error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue());
}
if (errorNode.hasNonNull(Constants.ERROR_DETAILS)) {
List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>();
for (final Iterator<JsonNode> itor = errorNode.get(Constants.ERROR_DETAILS).iterator(); itor.hasNext();) {
details.add(
itor.next().traverse(parser.getCodec()).<ResWrap<JSONODataErrorDetailImpl>>readValueAs(
new TypeReference<JSONODataErrorDetailImpl>() {
}).getPayload());
}
error.setDetails(details);
final List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>();
for (final Iterator<JsonNode> itor = errorNode.get(Constants.ERROR_DETAILS).iterator(); itor.hasNext();) {
details.add(itor.next().traverse(parser.getCodec()).<ResWrap<JSONODataErrorDetailImpl>>readValueAs(
new TypeReference<JSONODataErrorDetailImpl>() {
}).getPayload());
}
error.setDetails(details);
}
if (errorNode.hasNonNull(Constants.ERROR_INNERERROR)) {
JsonNode innerError = errorNode.get(Constants.ERROR_INNERERROR);
Dictionary<String, Object> innerErr = new Hashtable<String, Object>();
for (final Iterator<String> itor = innerError.fieldNames(); itor.hasNext();) {
String keyTmp = itor.next();
String val = innerError.get(keyTmp).toString();
innerErr.put(keyTmp,val);
}
error.setInnerError(innerErr);
final JsonNode innerError = errorNode.get(Constants.ERROR_INNERERROR);
for (final Iterator<String> itor = innerError.fieldNames(); itor.hasNext();) {
final String keyTmp = itor.next();
final String val = innerError.get(keyTmp).toString();
error.getInnerError().put(keyTmp, val);
}
}
}
return new ResWrap<JSONODataErrorImpl>((URI) null, null, error);
}
}

View File

@ -20,47 +20,37 @@ package org.apache.olingo.commons.core.data;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.data.Entity;
import org.apache.olingo.commons.api.data.ResWrap;
import org.apache.olingo.commons.api.domain.ODataErrorDetail;
public class JSONODataErrorDetailDeserializer extends
AbstractJsonDeserializer<JSONODataErrorDetailImpl> {
public class JSONODataErrorDetailDeserializer extends AbstractJsonDeserializer<JSONODataErrorDetailImpl> {
@Override
protected ResWrap<JSONODataErrorDetailImpl> doDeserialize(
final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
@Override
protected ResWrap<JSONODataErrorDetailImpl> doDeserialize(
final JsonParser parser, final DeserializationContext ctxt)
throws IOException, JsonProcessingException {
final JSONODataErrorDetailImpl error = new JSONODataErrorDetailImpl();
final JsonNode errorNode = parser.getCodec().readTree(parser);
if (errorNode.has(Constants.ERROR_CODE)) {
error.setCode(errorNode.get(Constants.ERROR_CODE).textValue());
}
if (errorNode.has(Constants.ERROR_MESSAGE)) {
final JsonNode message = errorNode.get(Constants.ERROR_MESSAGE);
if (message.isValueNode()) {
error.setMessage(message.textValue());
} else if (message.isObject()) {
error.setMessage(message.get(Constants.VALUE).asText());
}
}
if (errorNode.has(Constants.ERROR_TARGET)) {
error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue());
}
final JSONODataErrorDetailImpl error = new JSONODataErrorDetailImpl();
final JsonNode errorNode = parser.getCodec().readTree(parser);
if (errorNode.has(Constants.ERROR_CODE)) {
error.setCode(errorNode.get(Constants.ERROR_CODE).textValue());
}
if (errorNode.has(Constants.ERROR_MESSAGE)) {
final JsonNode message = errorNode.get(Constants.ERROR_MESSAGE);
if (message.isValueNode()) {
error.setMessage(message.textValue());
} else if (message.isObject()) {
error.setMessage(message.get(Constants.VALUE).asText());
}
}
if (errorNode.has(Constants.ERROR_TARGET)) {
error.setTarget(errorNode.get(Constants.ERROR_TARGET).textValue());
}
return new ResWrap<JSONODataErrorDetailImpl>((URI) null, null, error);
}
return new ResWrap<JSONODataErrorDetailImpl>((URI) null, null, error);
}
}

View File

@ -27,36 +27,36 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonDeserialize(using = JSONODataErrorDetailDeserializer.class)
public class JSONODataErrorDetailImpl implements ODataErrorDetail {
private String code;
private String code;
private String message;
private String message;
private String target;
private String target;
@Override
public String getCode() {
return code;
}
@Override
public String getCode() {
return code;
}
public void setCode(final String code) {
this.code = code;
}
public void setCode(final String code) {
this.code = code;
}
@Override
public String getMessage() {
return message;
}
@Override
public String getMessage() {
return message;
}
public void setMessage(final String message) {
this.message = message;
}
public void setMessage(final String message) {
this.message = message;
}
@Override
public String getTarget() {
return target;
}
@Override
public String getTarget() {
return target;
}
public void setTarget(final String target) {
this.target = target;
}
}
public void setTarget(final String target) {
this.target = target;
}
}