You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Riccardo Mariani (JIRA)" <ji...@apache.org> on 2015/11/03 19:52:27 UTC
[jira] [Commented] (OLINGO-811) Use of $count for expanded items
does not work
[ https://issues.apache.org/jira/browse/OLINGO-811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14987852#comment-14987852 ]
Riccardo Mariani commented on OLINGO-811:
-----------------------------------------
A possible solution:
{code:title=ODataJsonSerializer.java|borderStyle=solid}
protected void writeExpandedNavigationProperty(final ServiceMetadata metadata, final EdmNavigationProperty property,
final Link navigationLink, final ExpandOption innerExpand, final SelectOption innerSelect, final CountOption innerCount,
final JsonGenerator json) throws IOException, SerializerException {
json.writeFieldName(property.getName());
if (property.isCollection()) {
if (navigationLink == null || navigationLink.getInlineEntitySet() == null) {
json.writeStartArray();
json.writeEndArray();
} else {
if (innerCount != null && innerCount.getCount() != null) {
writeCount(navigationLink.getInlineEntitySet(), json);
}
writeEntitySet(metadata, property.getType(), navigationLink.getInlineEntitySet(), innerExpand,
innerSelect, false, json);
}
} else {
if (navigationLink == null || navigationLink.getInlineEntity() == null) {
json.writeNull();
} else {
writeEntity(metadata, property.getType(), navigationLink.getInlineEntity(), null,
innerExpand, innerSelect, false, json);
}
}
}
{code}
> Use of $count for expanded items does not work
> ----------------------------------------------
>
> Key: OLINGO-811
> URL: https://issues.apache.org/jira/browse/OLINGO-811
> Project: Olingo
> Issue Type: Bug
> Components: odata4-server
> Affects Versions: (Java) V4 4.0.0
> Reporter: Michael Bolz
>
> The {{$count}} query option within the {{$expand}} clause does not work correctly (see in [Specification|http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_The_$inlinecount_System]
> Example URL (for *TecSvc*):
> http://localhost:8080/odata.svc/ESAllPrim/?$expand=NavPropertyETTwoPrimMany($count=true)&$format=json&$count=true
> And example for OData-TripPin Service:
> [http://services.odata.org/V4/(S(kb3m31znaqv0xd4oqq0esxfv))/TripPinServiceRW/People?$expand=Trips($count=true)]
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)