@Override public void visit(CountOption info) { this.countOption = info.getValue(); }
/** * This method applies count query option to the given entity collection. * * @param countOption Count option * @param entitySet Entity collection */ public static void applyCountSystemQueryOption(final CountOption countOption, final EntityCollection entitySet) { if (countOption.getValue()) { entitySet.setCount(entitySet.getEntities().size()); } }
/** * To get the $count value from the query. * @param uriInfo * @param sqlList * @param request * @return null if this is not a count call. Otherwise will return the count value. * @throws ODataApplicationException */ private Integer getcount(UriInfo uriInfo,List<String> sqlList,ODataRequest request) throws ODataApplicationException{ Integer count =null; try { //To execute the $count query. if(uriInfo.getCountOption() != null && uriInfo.getCountOption().getValue() == true) { String countSql = sqlList.get(1); if(countSql != null) { ResultSet rs = cdsprocessor.execute(countSql,conn,request,timings); if(rs.next()) { count=rs.getInt(1); } } } } catch (SQLException e) { throw new ODataApplicationException("Could not execute the count query", HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), HeaderUtil.getlocale(request),e); } return count; }
throws IOException { if (countOption != null) { gen.writeBooleanField("isCount", countOption.getValue());
throws IOException { if (countOption != null) { gen.writeBooleanField("isCount", countOption.getValue());
if (options != null && options.getCount() != null && options.getCount().getValue() && entitySet.getCount() != null) { writeCount(entitySet, writer);
if (options != null && options.getCount() != null && options.getCount().getValue() && entitySet.getCount() != null) { writeCount(entitySet, writer);
ContextURLBuilder.create(options.getContextURL()).toASCIIString()); if (options != null && options.getCount() != null && options.getCount().getValue() && entitySet.getCount() != null) { writeCount(entitySet, writer);
if (options != null && options.getCount() != null && options.getCount().getValue()) { writeInlineCount("", entityCollection.getCount(), json);
ContextURLBuilder.create(options.getContextURL()).toASCIIString()); if (options != null && options.getCount() != null && options.getCount().getValue() && entitySet.getCount() != null) { writeCount(entitySet, writer);
if (options != null && options.getCount() != null && options.getCount().getValue()) { writeInlineCount("", entityCollection.getCount(), json);
writeContextURL(contextURL, json); if (options != null && options.getCount() != null && options.getCount().getValue()) { writeInlineCount(delta.getCount(), json);
writeContextURL(contextURL, json); if (options != null && options.getCount() != null && options.getCount().getValue()) { writeInlineCount(delta.getCount(), json);
writeContextURL(contextURL, json); if (options != null && options.getCount() != null && options.getCount().getValue()) { writeInlineCount(delta.getCount(), json);
if (options != null && options.getCount() != null && options.getCount().getValue()) { writeInlineCount("", entitySet.getCount(), json);
writeContextURL(contextURL, json); if (options != null && options.getCount() != null && options.getCount().getValue()) { writeInlineCount(delta.getCount(), json);
if (options != null && options.getCount() != null && options.getCount().getValue() && entitySet.getCount() != null) { writeCount(entitySet, writer);
if (options != null && options.getCount() != null && options.getCount().getValue() && entitySet.getCount() != null) { writeCount(entitySet, writer);
if (options != null && options.getCount() != null && options.getCount().getValue()) { writeInlineCount("", entitySet.getCount(), json);