You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Archana Rai (JIRA)" <ji...@apache.org> on 2017/03/28 08:12:41 UTC

[jira] [Updated] (OLINGO-1099) Refactor the V4 $levels implementation

     [ https://issues.apache.org/jira/browse/OLINGO-1099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Archana Rai updated OLINGO-1099:
--------------------------------
    Attachment: $level.diff

Hi Christian,

Please merge attached patch for $level.
Following things have been addressed by this fix:

1) There have been ExpandSelectHelper changes.  If they are not needed revert them.

- The unnecessary method isExpandAll is removed from this class. The references  are updated with an existing method getExpandAll.

2) With version 4.3.0 EntityIds suddenly became mandatory in the ODataEntity object. Revert this change.
-> If not there generate the key
-> if not possible to generate because key fields are missing or the id field isn`t set but the Id is mandatory then throw an exception

- For $level we will still be needing Ids because if the entity is already expanded we need to show the id. However I have updated the logic to get the ID of the entity. 
Now, if the id is null it will check for the entity details like requested entitySet name, entityType, key properties. It will generate the Id based on these values and will throw error only if these values are set to null.

3) Do not check for ancestors based on the ODataEntity ID. Just use object references and comape with ==
$levels=1 expandes Navigation properties for the first level. $levels=1 has the same functionality as leaving it away.

- We will need the Id for $level. Comparing the objects with equals is not the correct approach as the .equal implementation in our code checks for properties, associations, navigations and all the other parameters. Even if the entity is same we might end up getting "not equal". Comparing references might not work as well because we create our own references and point to to the object hence == might also fail. Therefore I have kept the comparison based on id only.

4) ExpandSelectHelper getExpandAll and isExpandAll have the same functionallity. Remove on method.
 
- isExpandAll has been removed

5) Only navigation properties of the same type get expanded. Not all of them. This is a bug.
Refactor navigation property serialization. There should only be one call to writeExpandedNavigation property! Not multiple ones based on some flags etc.

- This has been refactored.

6) Check for cycle only if navigation property has to be expanded.

- We are doing a check at the writeEntity level which is required if the navigated entity is actually a feed, which will trigger a call to writeEntityCollection that will again call writeEntity. Hence We will be needing the cycle check here.

> Refactor the V4 $levels implementation
> --------------------------------------
>
>                 Key: OLINGO-1099
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1099
>             Project: Olingo
>          Issue Type: Improvement
>          Components: odata4-server
>    Affects Versions: (Java) V4 4.1.0
>            Reporter: Archana Rai
>            Priority: Minor
>         Attachments: $level.diff
>
>
> Refactor the V4 $levels implementation based on the code review notes:
> There have been ExpandSelectHelper changes. If they are not needed revert them.
> With version 4.3.0 EntityIds  became mandatory in the ODataEntity object. Revert this change.
> -> If not there generate the key
> -> if not possible to generate because key fields are missing or the id field isn`t set but the Id is mandatory then throw an exception
> $levels specific:
> Do not check for ancestors based on the ODataEntity ID. Just use object references and comape with ==
> $levels=1 expandes Navigation properties for the first level. $levels=1 has the same functionality as leaving it away.
> ExpandSelectHelper getExpandAll and isExpandAll have the same functionallity. Remove on method.
> Important:
> Only navigation properties of the same type get expanded. Not all of them. This is a bug.
> Refactor navigation property serialization. There should only be one call to writeExpandedNavigation property! Not multiple ones based on some flags etc.
> Check for cycle only if navigation property has to be expanded.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)