You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/01/17 16:25:00 UTC

[jira] [Commented] (CAMEL-17506) olingo4 should always look for a single entity when a predicate key is used

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

Claus Ibsen commented on CAMEL-17506:
-------------------------------------

Tis code is from the creator of the component about the predicate.

The switch case is a entitySet so its a bit weird if the result is not a set.



> olingo4 should always look for a single entity when a predicate key is used
> ---------------------------------------------------------------------------
>
>                 Key: CAMEL-17506
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17506
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-olingo4
>    Affects Versions: 2.25.2, 3.14.0
>            Reporter: Damien B
>            Priority: Minor
>
> In org.apache.camel.component.olingo4.api.impl.Olingo4AppImpl , the following snippet of code is used to decide wether we receive an entity or an entitySet on a read query with a keyPredicate:
> {code:java}
> List<UriParameter> keyPredicates = uriResourceEntitySet.getKeyPredicates();
> // Check result type: single Entity or EntitySet based
> // on key predicate detection
> if (keyPredicates.size() == 1) {
>   response = (T) odataReader.readEntity(content, getResourceContentType(uriInfo));
> } else {
>   response = (T) odataReader.readEntitySet(content, getResourceContentType(uriInfo));
> } {code}
> It assumes that if we have multiple parts in the key predicate, then we expect several entities in the response. But as we can see in [OData Version 4.01. Part 2: URL Conventions (oasis-open.org)|https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_KeyasSegmentConvention] 4.3.6 example 26, a key predicate with several parts is just that, a multi-part key predicate still adressing a single entity.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)