Package com.google.api.gbase.client

Examples of com.google.api.gbase.client.GoogleBaseQuery


      System.err.println(" query");
      System.exit(1);
    }
   
    // Create a query URL from the given arguments
    GoogleBaseQuery query =
        new GoogleBaseQuery(urlFactory.getSnippetsFeedURL());
    query.setGoogleBaseQuery(queryString);
    query.setResultFormat(GoogleBaseQuery.ResultFormat.ATOM);
    query.setMaxResults(MAX_RESULTS);

    // Display the URL generated by the API
    System.out.println("Sending request to: " + query.getUrl());

    try {
      GoogleBaseFeed feed = service.query(query, GoogleBaseFeed.class);
      // Print the items
      printResult(feed);
View Full Code Here


  private String query;

  public void execute() throws Exception {

    // Build the query URL
    GoogleBaseQuery queryObject = new GoogleBaseQuery(getCustomerFeedURL());
    queryObject.setGoogleBaseQuery(query);

    Service service = createService();
    Service.GDataRequest request =
        service.createFeedRequest(queryObject.getUrl());

    // Send the request (HTTP GET)
    request.execute();

    outputRawResponse(request);
View Full Code Here

   */
  private static void queryLocales()
      throws IOException, ServiceException {
    // Create a query URL
    URL url = urlFactory.getLocalesFeedURL();
    GoogleBaseQuery query = new GoogleBaseQuery(url);

    // Display the URL generated by the API
    System.out.println("Sending request to: " + query.getUrl());

    try {
      GoogleBaseFeed feed = service.query(query);
      // Print the locales
      for (GoogleBaseEntry entry : feed.getEntries()) {
View Full Code Here

   */
  private static void queryItemTypes(String locale)
      throws IOException, ServiceException {
    // Create a query URL from the given arguments
    URL url = urlFactory.getItemTypesFeedURL(locale);
    GoogleBaseQuery query = new GoogleBaseQuery(url);

    // Display the URL generated by the API
    System.out.println("Sending request to: " + query.getUrl());

    try {
      GoogleBaseFeed feed = service.query(query);
      // Print the item types
      printItemTypeFeed(feed);
View Full Code Here

   */
  private static void queryMetadata(String queryString)
      throws IOException, ServiceException {
    // Create a query URL from the given arguments
    URL url = urlFactory.getAttributesFeedURL();
    GoogleBaseQuery query = new GoogleBaseQuery(url);
    query.setGoogleBaseQuery(queryString);

    // Display the URL generated by the API
    System.out.println("Sending request to: " + query.getUrl());

    try {
      GoogleBaseFeed feed = service.query(query);
      // Print the items
      printMetadataFeed(feed);
View Full Code Here

   * @param attrNames the names of the attributes
   */
  protected void retrieveMostUsedValues(int numValue, final String... attrNames)
      throws ServiceException, IOException {
    URL url = urlFactory.getAttributesFeedURL();
    GoogleBaseQuery query = new GoogleBaseQuery(url);
   
    StringBuffer queryString = createQueryString(attrNames);
    query.setGoogleBaseQuery(queryString.toString());
    query.setMaxValues(numValue);

    int numResults = 0;
    int lastNumResults = 0;
    Collection<String> attrToRetrieve =
        new ArrayList<String>(Arrays.asList(attrNames));
    do {
      // Get the feed
      numResults += STEP_MAXRESULTS;
      query.setMaxResults(numResults);
      GoogleBaseFeed feed = service.query(query);
      if (lastNumResults == feed.getTotalResults()) {
        // No new entries to process
        break;
      }
View Full Code Here

    return (total - 1) / maxResults;
  }

  /** Runs the query and fills the result. */
  public void runQuery() throws IOException, ServiceException {
    GoogleBaseQuery query = createQuery();
    System.out.println("Searching: " + query.getUrl());
    GoogleBaseFeed feed = service.query(query);
    List<Recipe> result = new ArrayList<Recipe>(maxResults);
    for (GoogleBaseEntry entry : feed.getEntries()) {
      result.add(new Recipe(entry));
    }
View Full Code Here

    if (ownItems) {
      queryUrl = urlFactory.getItemsFeedURL();
    } else {
      queryUrl = urlFactory.getSnippetsFeedURL();
    }
    GoogleBaseQuery query = new GoogleBaseQuery(queryUrl);
    query.setMaxResults(maxResults);
    if (startIndex > 0) {
      // the first index is 1
      query.setStartIndex(startIndex + 1);
    }
    query.setGoogleBaseQuery(createQueryString());
    return query;
  }
View Full Code Here

TOP

Related Classes of com.google.api.gbase.client.GoogleBaseQuery

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.