[
https://issues.apache.org/jira/browse/OLINGO-1129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16074280#comment-16074280
]
Ramya commented on OLINGO-1129:
-------------------------------
Hi Hui Wang,
The inline data is fetched based on the inline entity set by the service
developer while creating the service. The library just fetches this inline
Entity and creates the response. When the service developer creates links for
every navigation property he also sets the inlineEntity. When the url is
http://host/service/Orders?$expand=Customer/Model.VipCustomer, the service
developer should create a link for navigation property Customer and set the
inline entity data to have all the properties of the derived type.
When the url is of the form
http://host/service/Orders?$expand=Customer/Model.VipCustomer, olingo library
parses this url and sets the entryTypeFilter or collectionTypeFilter property
when parsing the expand options. In this case the navigation property Customer
will include the information regarding the type cast. This information can be
fetched in the processor classes created by the service developer like below
uriInfo.getExpandOption().getExpandItems().get(0).getResourcePath().getUriResourceParts().get(0)
which will return UriResourceNavigation. Then use methods
getTypeFilterOnEntry() or getTypeFilterOnCollection() to fetch the type casting
information. Based on the edm entity type fetched from previous lines of code
you can set correct inline entities for every navigation link created.
Regards,
Ramya
> ODataJsonSerializer Does Not Support Derived Type in $expand Option
> -------------------------------------------------------------------
>
> Key: OLINGO-1129
> URL: https://issues.apache.org/jira/browse/OLINGO-1129
> Project: Olingo
> Issue Type: New Feature
> Components: odata4-server
> Affects Versions: (Java) V4 4.3.0
> Reporter: Hui Wang
> Priority: Minor
>
> Currently we need to use type casting to a derived type in $expand. Here is
> the corresponding part in the OData Protocol.
> http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions-complete.html#_Toc453752352
> To reproduce:
> Here is an example URL provided in the documentation that could be used for
> reproducing the defect:
> http://host/service/Orders?$expand=Customer/Model.VipCustomer
> In the current 4.3 version, ODataJsonSerializer only deals with expand on
> Customer but ignores the type filter Model.VipCustomer. It means, the
> response would only show the content of super type Customer. Any custom
> properties in derived type VipCustomer wouldn't be returned.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)