* 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();
URI serviceRoot = pathInfo.getServiceRoot();
entityFeedPropertiesBuilder =
EntityProviderWriteProperties.serviceRoot(pathInfo.getServiceRoot());
JPAPaging paging = odataJPAContext.getPaging();
if (odataJPAContext.getPageSize() > 0 && paging != null && paging.getNextPage() > 0) {
String nextLink =
serviceRoot.relativize(pathInfo.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());
Map<String, ODataCallback> expandCallBack =
JPAExpandCallBack.getCallbacks(serviceRoot, expandSelectTree, resultsView.getExpand());
Map<String, ODataCallback> callBackMap = new HashMap<String, ODataCallback>();
callBackMap.putAll(expandCallBack);
String deltaToken = ODataJPATombstoneContext.getDeltaToken();
if (deltaToken != null) {
callBackMap.put(TombstoneCallback.CALLBACK_KEY_TOMBSTONE, new JPATombstoneCallBack(serviceRoot.toString(),
resultsView, deltaToken));
}
entityFeedPropertiesBuilder.callbacks(callBackMap);
entityFeedPropertiesBuilder.expandSelectTree(expandSelectTree);
} catch (ODataException e) {
throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
}
return entityFeedPropertiesBuilder.build();
}