[ 
https://issues.apache.org/jira/browse/OLINGO-1129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16104394#comment-16104394
 ] 

Ramya commented on OLINGO-1129:
-------------------------------

Hi Hui Wang,
Serializer only serializes data which is sent to it and does not fetch the data 
based on type casts. That has to be done by the service developer. While 
creating the service when you set links for each inline entity you must set the 
correct inline data based on this type cast information that is part of the uri.
You can check the class DataCreator part of commit 
https://git-wip-us.apache.org/repos/asf?p=olingo-odata4.git;a=commit;h=f6dd0deacc27a21ec2273cb58735005712fe1dd7
 where links are set. You need to check for the type cast here and set the 
correct inline entity.
A link is created as below
      Link link = new Link();
      link.setRel("http://docs.oasis-open.org/odata/ns/related/"; + 
navigationPropertyName);
      
link.setType(ContentType.APPLICATION_ATOM_XML_ENTRY.toContentTypeString());
      link.setTitle(navigationPropertyName);
      link.setHref(target.getId().toASCIIString());
      entity.getNavigationLinks().add(link);
      link.setInlineEntity(target);
Here target is the type casted entity.

Please get back if it is unclear.

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)

Reply via email to