@Override public ODataResponse countEntitySet(final GetEntitySetCountUriInfo uriInfo, final String contentType) throws ODataException { ArrayList<Object> data = new ArrayList<Object>(); try { data.addAll((List<?>) retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments())); } catch (final ODataNotFoundException e) { data.clear(); } applySystemQueryOptions( uriInfo.getTargetEntitySet(), data, uriInfo.getFilter(), null, null, null, uriInfo.getSkip(), uriInfo.getTop()); return ODataResponse.fromResponse(EntityProvider.writeText(String.valueOf(data.size()))).build(); }
@Override public IDataProviderResponse countEntitySet(GetEntitySetCountUriInfo uriInfo, ODataContext context) throws ODataException { GetEntitySetCountUriInfo resolvedUriInfo = resolveCrossServiceNavigation((UriInfo) uriInfo, true, context); IDataProvider provider = getTargetDataProvider(resolvedUriInfo.getFunctionImport(), resolvedUriInfo.getStartEntitySet()); if (provider == null) { GWUriInfo entitySetUriInfo = new GWUriInfo((UriInfo) uriInfo, uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getNavigationSegments(), uriInfo.getFilter()); BaseDataProviderResponse response = (BaseDataProviderResponse) readEntitySet(entitySetUriInfo, context); if (response.getCount() == null) { response.setCount(Integer.toString(response.getResultEntities().size())); } return response; } else { return provider.countEntitySet(resolvedUriInfo, context); } }
@Override public IDataProviderResponse countEntitySet(GetEntitySetCountUriInfo uriInfo, ODataContext context) throws ODataException { IDataProvider dataProvider = null; String targetEntitySet = uriInfo.getTargetEntitySet().getEntityType().getNamespace()+"."+uriInfo.getTargetEntitySet().getName(); dataProvider = getDataProvider(targetEntitySet); try{ if (dataProvider !=null){ return dataProvider.countEntitySet(uriInfo, context); } else return null; } catch (ODataException e) { logger.error("Error in countEntity",e); throw new ODataException(e.getMessage(),e); } }
this.gwlog.debug("countEntitySet(): " + TraceUtil.getEntitySetLog(uriInfo.getStartEntitySet()) + ", content type = " + (contentType == null ? "<null>" : contentType));
IDataProvider.class); String entitySetName = uriInfo.getTargetEntitySet().getName(); try{ GetEntityUriInfo uInfo = (GetEntityUriInfo) uriInfo;
@Override public ODataResponse countEntitySet(final GetEntitySetCountUriInfo uriInfo, final String contentType) throws ODataException { ArrayList<Object> data = new ArrayList<Object>(); try { data.addAll((List<?>) retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments())); } catch (final ODataNotFoundException e) { data.clear(); } applySystemQueryOptions( uriInfo.getTargetEntitySet(), data, uriInfo.getFilter(), null, null, null, uriInfo.getSkip(), uriInfo.getTop()); return ODataResponse.fromResponse(EntityProvider.writeText(String.valueOf(data.size()))).build(); }
@Override public ODataResponse countEntitySet(final GetEntitySetCountUriInfo uriInfo, final String contentType) throws ODataException { ArrayList<Object> data = new ArrayList<Object>(); try { data.addAll((List<?>) retrieveData( uriInfo.getStartEntitySet(), uriInfo.getKeyPredicates(), uriInfo.getFunctionImport(), mapFunctionParameters(uriInfo.getFunctionImportParameters()), uriInfo.getNavigationSegments())); } catch (final ODataNotFoundException e) { data.clear(); } applySystemQueryOptions( uriInfo.getTargetEntitySet(), data, uriInfo.getFilter(), null, null, null, uriInfo.getSkip(), uriInfo.getTop()); return ODataResponse.fromResponse(EntityProvider.writeText(String.valueOf(data.size()))).build(); }