* be registered here
*/
private static EntityProviderWriteProperties getEntityProviderProperties(final ODataJPAContext odataJPAContext,
final GetEntitySetUriInfo resultsView, final List<Map<String, Object>> edmEntityList)
throws ODataJPARuntimeException {
ODataEntityProviderPropertiesBuilder entityFeedPropertiesBuilder = null;
ODataContext context = odataJPAContext.getODataContext();
Integer count = null;
if (resultsView.getInlineCount() != null) {
if ((resultsView.getSkip() != null || resultsView.getTop() != null)) {
// when $skip and/or $top is present with $inlinecount
count = getInlineCountForNonFilterQueryEntitySet(edmEntityList, resultsView);
} else {
// In all other cases
count = resultsView.getInlineCount() == InlineCount.ALLPAGES ? edmEntityList.size() : null;
}
}
try {
PathInfo pathInfo = context.getPathInfo();
entityFeedPropertiesBuilder =
EntityProviderWriteProperties.serviceRoot(pathInfo.getServiceRoot());
JPAPaging paging = odataJPAContext.getPaging();
if (odataJPAContext.getPageSize() > 0 && paging != null && paging.getNextPage() > 0) {
String nextLink =
pathInfo.getServiceRoot().relativize(context.getPathInfo().getRequestUri()).toString();
nextLink = percentEncodeNextLink(nextLink);
nextLink += (nextLink.contains("?") ? "&" : "?")
+ "$skiptoken=" + odataJPAContext.getPaging().getNextPage();
entityFeedPropertiesBuilder.nextLink(nextLink);
}
entityFeedPropertiesBuilder.inlineCount(count);
entityFeedPropertiesBuilder.inlineCountType(resultsView.getInlineCount());
ExpandSelectTreeNode expandSelectTree =
UriParser.createExpandSelectTree(resultsView.getSelect(), resultsView.getExpand());
entityFeedPropertiesBuilder.callbacks(JPAExpandCallBack.getCallbacks(context
.getPathInfo().getServiceRoot(), expandSelectTree, resultsView.getExpand()));
entityFeedPropertiesBuilder.expandSelectTree(expandSelectTree);
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
}
return entityFeedPropertiesBuilder.build();
}