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

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

Damien B created CAMEL-17506:
--------------------------------

             Summary: 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: 3.14.0, 2.25.2
            Reporter: Damien B


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)