private static Integer getInlineCountForNonFilterQueryLinks(final List<Map<String, Object>> edmEntityList, final GetEntitySetLinksUriInfo resultsView) { // when $skip and/or $top is present with $inlinecount, first get the total count Integer count = null; if (resultsView.getInlineCount() == InlineCount.ALLPAGES) { if (resultsView.getSkip() != null || resultsView.getTop() != null) { count = edmEntityList.size(); // Now update the list if (resultsView.getSkip() != null) { // Index checks to avoid IndexOutOfBoundsException if (resultsView.getSkip() > edmEntityList.size()) { edmEntityList.clear(); return count; } edmEntityList.subList(0, resultsView.getSkip()).clear(); } if (resultsView.getTop() != null && resultsView.getTop() >= 0 && resultsView.getTop() < edmEntityList.size()) { edmEntityList.subList(0, resultsView.getTop()); } } }// Inlinecount of None is handled by default - null return count; }
try { data.addAll((List<?>) retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments())); } catch (final ODataNotFoundException e) { data.clear(); uriInfo.getTargetEntitySet(), data, uriInfo.getFilter(), uriInfo.getInlineCount(), uriInfo.getSkipToken(), uriInfo.getSkip(), uriInfo.getTop()); final EdmEntitySet entitySet = uriInfo.getTargetEntitySet(); final EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties .serviceRoot(context.getPathInfo().getServiceRoot()) .inlineCountType(uriInfo.getInlineCount()) .inlineCount(count) .build();
EdmEntitySet entitySet = resultsView.getTargetEntitySet(); edmEntityType = entitySet.getEntityType(); List<EdmProperty> keyProperties = edmEntityType.getKeyProperties(); if (resultsView.getInlineCount() != null) { if ((resultsView.getSkip() != null || resultsView.getTop() != null)) { count = resultsView.getInlineCount() == InlineCount.ALLPAGES ? edmEntityList.size() : null; EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties.serviceRoot(context.getPathInfo().getServiceRoot()).inlineCountType( resultsView.getInlineCount()) .clientCallbacks(resultsView.getClientCallbacks()).callback(resultsView.getCallback()).inlineCount(count).build();
EdmEntitySet entitySet = resultsView.getTargetEntitySet(); edmEntityType = entitySet.getEntityType(); List<EdmProperty> keyProperties = edmEntityType.getKeyProperties(); if (resultsView.getInlineCount() != null) { if ((resultsView.getSkip() != null || resultsView.getTop() != null)) { count = resultsView.getInlineCount() == InlineCount.ALLPAGES ? edmEntityList.size() : null; EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties.serviceRoot(context.getPathInfo().getServiceRoot()).inlineCountType( resultsView.getInlineCount()).inlineCount(count).build();
@Override public IDataProviderResponse readEntityLinks(GetEntitySetLinksUriInfo uriInfo, ODataContext context) throws ODataException { GetEntitySetLinksUriInfo resolvedUriInfo = resolveCrossServiceNavigation((UriInfo) uriInfo, context); IDataProvider provider = getTargetDataProvider(resolvedUriInfo.getFunctionImport(), resolvedUriInfo.getStartEntitySet()); if (provider == null) { throw new DataProviderException(DataProviderException.NOT_IMPLEMENTED.addContent("readEntityLinks"), context.getAcceptableLanguages().get(0)); } else { return provider.readEntityLinks(resolvedUriInfo, context); } }
try { data.addAll((List<?>) retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments())); } catch (final ODataNotFoundException e) { data.clear(); uriInfo.getTargetEntitySet(), data, uriInfo.getFilter(), uriInfo.getInlineCount(), uriInfo.getSkipToken(), uriInfo.getSkip(), uriInfo.getTop()); final EdmEntitySet entitySet = uriInfo.getTargetEntitySet(); final EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties .serviceRoot(context.getPathInfo().getServiceRoot()) .inlineCountType(uriInfo.getInlineCount()) .inlineCount(count) .clientCallbacks(uriInfo.getClientCallbacks()) .callback(uriInfo.getCallback()) .build();
try { data.addAll((List<?>) retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments())); } catch (final ODataNotFoundException e) { data.clear(); uriInfo.getTargetEntitySet(), data, uriInfo.getFilter(), uriInfo.getInlineCount(), uriInfo.getSkipToken(), uriInfo.getSkip(), uriInfo.getTop()); final EdmEntitySet entitySet = uriInfo.getTargetEntitySet(); final EntityProviderWriteProperties entryProperties = EntityProviderWriteProperties .serviceRoot(context.getPathInfo().getServiceRoot()) .inlineCountType(uriInfo.getInlineCount()) .inlineCount(count) .build();
private static Integer getInlineCountForNonFilterQueryLinks(final List<Map<String, Object>> edmEntityList, final GetEntitySetLinksUriInfo resultsView) { // when $skip and/or $top is present with $inlinecount, first get the total count Integer count = null; if (resultsView.getInlineCount() == InlineCount.ALLPAGES) { if (resultsView.getSkip() != null || resultsView.getTop() != null) { count = edmEntityList.size(); // Now update the list if (resultsView.getSkip() != null) { // Index checks to avoid IndexOutOfBoundsException if (resultsView.getSkip() > edmEntityList.size()) { edmEntityList.clear(); return count; } edmEntityList.subList(0, resultsView.getSkip()).clear(); } if (resultsView.getTop() != null && resultsView.getTop() >= 0 && resultsView.getTop() < edmEntityList.size()) { edmEntityList.subList(0, resultsView.getTop()); } } }// Inlinecount of None is handled by default - null return count; }