Package com.assaydepot.result

Examples of com.assaydepot.result.Results


      urlBuilder.append( "&access_token=" ).append( conf.getApiToken() );
    }

    JsonNode rootNode = doParseURL( urlBuilder.toString() );   

    Results results = new Results();

    results.setTotal( rootNode.path( "total" ).getIntValue() );
    results.setPage( rootNode.path( "page" ).getIntValue() );
    results.setPerPage( rootNode.path( "per_page" ).getIntValue() );
    results.setQueryTime( rootNode.path( "query_time" ).getDoubleValue() );
    results.setFacets( doFacets( rootNode.path( "facets" )));
    results.setProviderRefs( doProviderRefs( rootNode.path( "provider_refs" )));
   
    return results;
  }
View Full Code Here


        urlBuilder.append( "&access_token=" ).append( conf.getApiToken() );
      }

      JsonNode rootNode = doParseURL( urlBuilder.toString() );   

      Results results = new Results();

      results.setTotal( rootNode.path( "total" ).getIntValue() );
      results.setPage( rootNode.path( "page" ).getIntValue() );
      results.setPerPage( rootNode.path( "per_page" ).getIntValue() );
      results.setQueryTime( rootNode.path( "query_time" ).getDoubleValue() );
      results.setFacets( doFacets( rootNode.path( "facets" )));
      results.setWareRefs( doWareRefs( rootNode.path( "ware_refs" )));
     
      return results;
  }
View Full Code Here

    URL url = new URL( urlBuilder.toString() );
    JsonFactory f = new JsonFactory();
    JsonParser jp = f.createJsonParser( url.openStream() );
   
    Results results = new Results();
    results.setProviderRefs( new ArrayList<ProviderRef>() );
    results.setProviders( new ArrayList<Provider>() );
    results.setFacets( new HashMap<String,Map<String,String>>() );
   
   
    jp.nextToken(); // will return JsonToken.START_OBJECT (verify?)
    //
    // Get result metadata
    //
    while (jp.nextToken() != JsonToken.END_OBJECT) {
      String fieldName = jp.getCurrentName();
      jp.nextToken(); // move to value, or START_OBJECT/START_ARRAY
      //
      // Build the Results object
      //
      if( "total".equals( fieldName )) {
        results.setTotal( jp.getIntValue() );
      } else if( "page".equals( fieldName )) {
        results.setPage( jp.getIntValue() );
      } else if( "per_page".equals( fieldName )) {
        results.setPerPage( jp.getIntValue() );
      } else if( "query_time".equals( fieldName )) {
        results.setQueryTime( jp.getDoubleValue() );
      } else if ("facets".equals( fieldName )) { // contains an object
        Map<String,String> facetMap = null;
        while ( jp.nextToken() != JsonToken.END_OBJECT ) {
          fieldName = jp.getCurrentName();
          facetMap = new HashMap<String,String>();
          results.getFacets().put( fieldName, facetMap );
          JsonToken token = jp.nextToken();
          while ( token != JsonToken.END_OBJECT ) {
            if( token == JsonToken.START_OBJECT ) { // skip the "{" for each facet
              token = jp.nextToken();
              if( token == JsonToken.END_OBJECT ) {
                token = jp.nextToken();
              }
            }
          }
          System.out.println( "token1 = ["+token+"]");
          token = jp.nextToken();
//          results.getFacets().get( fieldName ).put( value1, value2 ));
          System.out.println( "token2 = ["+token+"]");
          System.out.println( "token3 = ["+jp.getText()+"]");
        }
      } else if ("providerRefs".equals( fieldName )) {
        getProviderRefs( jp, results );
      } else {
//        throw new IllegalStateException("Unrecognized field '"+fieldName+"'!");
        System.out.println("Unrecognized field '"+fieldName+"'!");
      }
    }
   
    //
    // Get result providers
    //
    Provider provider = new Provider();
   
    while (jp.nextToken() != JsonToken.END_OBJECT) {
      String fieldName = jp.getCurrentName();
      jp.nextToken(); // move to value, or START_OBJECT/START_ARRAY
      //
      // Build the Results object
      //
      if( "total".equals( fieldName )) {
        results.setTotal( jp.getIntValue() );
      } else if( "page".equals( fieldName )) {
        results.setPage( jp.getIntValue() );
    jp.close(); // ensure resources get cleaned up timely and properly
   
      }

    }
View Full Code Here

    URL url = new URL( urlBuilder.toString() );
    JsonFactory f = new JsonFactory();
    JsonParser jp = f.createJsonParser( url.openStream() );
   
    Results results = new Results();
    results.setProviderRefs( new ArrayList<ProviderRef>() );
    results.setFacets( new HashMap<String,Map<String,String>>() );
   
   
    jp.nextToken(); // will return JsonToken.START_OBJECT (verify?)
    //
    // Get result metadata
    //
    while (jp.nextToken() != JsonToken.END_OBJECT) {
      String fieldName = jp.getCurrentName();
      jp.nextToken(); // move to value, or START_OBJECT/START_ARRAY
      //
      // Build the Results object
      //
      if( "total".equals( fieldName )) {
        results.setTotal( jp.getIntValue() );
      } else if( "page".equals( fieldName )) {
        results.setPage( jp.getIntValue() );
      } else if( "per_page".equals( fieldName )) {
        results.setPerPage( jp.getIntValue() );
      } else if( "query_time".equals( fieldName )) {
        results.setQueryTime( jp.getDoubleValue() );
      } else if ("facets".equals( fieldName )) { // contains an object
        Map<String,String> facetMap = null;
        while ( jp.nextToken() != JsonToken.END_OBJECT ) {
          fieldName = jp.getCurrentName();
          facetMap = new HashMap<String,String>();
          results.getFacets().put( fieldName, facetMap );
          JsonToken token = jp.nextToken();
          while ( token != JsonToken.END_OBJECT ) {
            if( token == JsonToken.START_OBJECT ) { // skip the "{" for each facet
              token = jp.nextToken();
              if( token == JsonToken.END_OBJECT ) {
                token = jp.nextToken();
              }
            }
          }
          System.out.println( "token1 = ["+token+"]");
          token = jp.nextToken();
//          results.getFacets().get( fieldName ).put( value1, value2 ));
          System.out.println( "token2 = ["+token+"]");
          System.out.println( "token3 = ["+jp.getText()+"]");
        }
      } else if ("providerRefs".equals( fieldName )) {
        parseProviderRefs( jp, results );
      } else {
//        throw new IllegalStateException("Unrecognized field '"+fieldName+"'!");
        System.out.println("Unrecognized field '"+fieldName+"'!");
      }
    }
   
    //
    // Get result providers
    //
    Provider provider = new Provider();
   
    while (jp.nextToken() != JsonToken.END_OBJECT) {
      String fieldName = jp.getCurrentName();
      jp.nextToken(); // move to value, or START_OBJECT/START_ARRAY
      //
      // Build the Results object
      //
      if( "total".equals( fieldName )) {
        results.setTotal( jp.getIntValue() );
      } else if( "page".equals( fieldName )) {
        results.setPage( jp.getIntValue() );
    jp.close(); // ensure resources get cleaned up timely and properly
   
      }

    }
View Full Code Here

  }
 
  private Results getProviderRefsByURL( String url ) {
    JsonNode rootNode = doParseURL( url );   

    Results results = new Results();

    results.setTotal( rootNode.path( "total" ).getIntValue() );
    results.setPage( rootNode.path( "page" ).getIntValue() );
    results.setPerPage( rootNode.path( "per_page" ).getIntValue() );
    results.setQueryTime( rootNode.path( "query_time" ).getDoubleValue() );
    results.setFacets( doFacets( rootNode.path( "facets" )));
    results.setProviderRefs( doProviderRefs( rootNode.path( "provider_refs" )));
   
    return results;
   
  }
View Full Code Here

  }
 
  private Results getWareRefsByURL( String url ) {
    JsonNode rootNode = doParseURL( url );   

    Results results = new Results();

    results.setTotal( rootNode.path( "total" ).getIntValue() );
    results.setPage( rootNode.path( "page" ).getIntValue() );
    results.setPerPage( rootNode.path( "per_page" ).getIntValue() );
    results.setQueryTime( rootNode.path( "query_time" ).getDoubleValue() );
    results.setFacets( doFacets( rootNode.path( "facets" )));
    results.setWareRefs( doWareRefs( rootNode.path( "ware_refs" )));
   
    return results;   
  }
View Full Code Here

   
    return ware;
  }

  public Collection<String> getAvailableWareRefFacetNames() {
    Results results = getWareRefs("antibody");
    return results.getFacets().keySet();
  }
View Full Code Here

    Results results = getWareRefs("antibody");
    return results.getFacets().keySet();
  }

  public Collection<String> getAvailableProviderRefFacetNames() {
    Results results = getProviderRefs("antibody");
    return results.getFacets().keySet();
  }
View Full Code Here

TOP

Related Classes of com.assaydepot.result.Results

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.