private LastPointQuery parseLastPointQuery(final TSDB tsdb, 
      final HttpQuery http_query) {
    final LastPointQuery query = new LastPointQuery();
    
    if (http_query.hasQueryStringParam("resolve")) {
      query.setResolveNames(true);
    }
    
    if (http_query.hasQueryStringParam("back_scan")) {
      try {
        query.setBackScan(Integer.parseInt(http_query.getQueryStringParam("back_scan")));
      } catch (NumberFormatException e) {
        throw new BadRequestException("Unable to parse back_scan parameter");
      }
    }
    
    final List<String> ts_queries = http_query.getQueryStringParams("timeseries");
    final List<String> tsuid_queries = http_query.getQueryStringParams("tsuids");
    final int num_queries = 
      (ts_queries != null ? ts_queries.size() : 0) +
      (tsuid_queries != null ? tsuid_queries.size() : 0);
    final List<LastPointSubQuery> sub_queries = 
      new ArrayList<LastPointSubQuery>(num_queries);
    
    if (ts_queries != null) {
      for (String ts_query : ts_queries) {
        sub_queries.add(LastPointSubQuery.parseTimeSeriesQuery(ts_query));
      }
    }
    
    if (tsuid_queries != null) {
      for (String tsuid_query : tsuid_queries) {
        sub_queries.add(LastPointSubQuery.parseTSUIDQuery(tsuid_query));
      }
    }
    
    query.setQueries(sub_queries);
    return query;
  }
private LastPointQuery parseLastPointQuery ( final TSDB tsdb , final HttpQuery http_query ) { final LastPointQuery query = new LastPointQuery ( ) ; if ( http_query . hasQueryStringParam ( "resolve" ) ) { query . setResolveNames ( true ) ; } if ( http_query . hasQueryStringParam ( "back_scan" ) ) { try { query . setBackScan ( Integer . parseInt ( http_query . getQueryStringParam ( "back_scan" ) ) ) ; } catch ( NumberFormatException e ) { throw new BadRequestException ( "Unable to parse back_scan parameter" ) ; } } final List < String > ts_queries = http_query . getQueryStringParams ( "timeseries" ) ; final List < String > tsuid_queries = http_query . getQueryStringParams ( "tsuids" ) ; final int num_queries = ( ts_queries != null ? ts_queries . size ( ) : 0 ) + ( tsuid_queries != null ? tsuid_queries . size ( ) : 0 ) ; final List < LastPointSubQuery > sub_queries = new ArrayList < LastPointSubQuery > ( num_queries ) ; if ( ts_queries != null ) { for ( String ts_query : ts_queries ) { sub_queries . add ( LastPointSubQuery . parseTimeSeriesQuery ( ts_query ) ) ; } } if ( tsuid_queries != null ) { for ( String tsuid_query : tsuid_queries ) { sub_queries . add ( LastPointSubQuery . parseTSUIDQuery ( tsuid_query ) ) ; } } query . setQueries ( sub_queries ) ; return query ; }
Parses a last point query from the URI string
@param tsdb The TSDB to which we belong
@param http_query The HTTP query to work with
@return A LastPointQuery object to execute against
@throws BadRequestException if parsing failed