Package com.google.api.ads.dfp.v201302

Examples of com.google.api.ads.dfp.v201302.ResultSet


      // Get the CreativeService.
      CreativeServiceInterface creativeService =
          user.getService(DfpService.V201302.CREATIVE_SERVICE);

      // Create a statement to get all image creatives.
      Statement filterStatement =
          new StatementBuilder("WHERE creativeType = :creativeType LIMIT 500")
              .putValue("creativeType", ImageCreative.class.getSimpleName()).toStatement();

      // Get creatives by statement.
      CreativePage page = creativeService.getCreativesByStatement(filterStatement);
View Full Code Here


   */
  public static Value createValue(Object value) {
    if (value instanceof Value) {
      return (Value) value;
    } else if (value == null) {
      return new TextValue(null, null);
    } else {
      if (value instanceof Boolean) {
        return new BooleanValue(null, (Boolean) value);
      } else if (value instanceof Double) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof String) {
        return new TextValue(null, (String) value);
      } else if (value instanceof Long) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof DateTime) {
        return new DateTimeValue(null, (DateTime) value);
      } else {
View Full Code Here

      // may be left off, i.e. just "SELECT * FROM Browser_Groups LIMIT 500"
      String selectStatement = "SELECT * FROM City WHERE targetable = true LIMIT 500";
      int offset = 0;
      int resultSetSize = 0;
      List<Row> allRows = new ArrayList<Row>();
      ResultSet resultSet;
     
      do {
        StatementBuilder statementBuilder =
            new StatementBuilder(selectStatement + " OFFSET " + offset);
       
        // Get all cities.
        resultSet = pqlService.select(statementBuilder.toStatement());

        // Collect all cities from each page.
        allRows.addAll(Arrays.asList(resultSet.getRows()));
       
        // Display results.
        System.out.println(PqlUtils.resultSetToString(resultSet));
       
        offset += 500;
        resultSetSize = resultSet.getRows() == null ? 0 : resultSet.getRows().length;
      } while (resultSetSize == 500);
     
      System.out.println("Number of results found: " + allRows.size());
     
      // Optionally, save all rows to a CSV.
      resultSet.setRows(allRows.toArray(new Row[] {}));
      CsvUtils.writeCsv(PqlUtils.resultSetToStringArrayList(resultSet), "cities.csv");      
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      // may be left off, i.e. just "SELECT * FROM Browser_Groups LIMIT 500"
      String selectStatement = "SELECT * FROM City WHERE targetable = true LIMIT 500";
      int offset = 0;
      int resultSetSize = 0;
      List<Row> allRows = new ArrayList<Row>();
      ResultSet resultSet;
     
      do {
        StatementBuilder statementBuilder =
            new StatementBuilder(selectStatement + " OFFSET " + offset);
       
        // Get all cities.
        resultSet = pqlService.select(statementBuilder.toStatement());

        // Collect all cities from each page.
        allRows.addAll(Arrays.asList(resultSet.getRows()));
       
        // Display results.
        System.out.println(PqlUtils.resultSetToString(resultSet));
       
        offset += 500;
        resultSetSize = resultSet.getRows() == null ? 0 : resultSet.getRows().length;
      } while (resultSetSize == 500);
     
      System.out.println("Number of results found: " + allRows.size());
     
      // Optionally, save all rows to a CSV.
      resultSet.setRows(allRows.toArray(new Row[] {}));
      CsvUtils.writeCsv(PqlUtils.resultSetToStringArrayList(resultSet), "cities.csv");      
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      // may be left off, i.e. just "SELECT * FROM Browser_Groups LIMIT 500"
      String selectStatement = "SELECT * FROM City WHERE targetable = true LIMIT 500";
      int offset = 0;
      int resultSetSize = 0;
      List<Row> allRows = new ArrayList<Row>();
      ResultSet resultSet;
     
      do {
        StatementBuilder statementBuilder =
            new StatementBuilder(selectStatement + " OFFSET " + offset);
       
        // Get all cities.
        resultSet = pqlService.select(statementBuilder.toStatement());

        // Collect all cities from each page.
        allRows.addAll(Arrays.asList(resultSet.getRows()));
       
        // Display results.
        System.out.println(PqlUtils.resultSetToString(resultSet));
       
        offset += 500;
        resultSetSize = resultSet.getRows() == null ? 0 : resultSet.getRows().length;
      } while (resultSetSize == 500);
     
      System.out.println("Number of results found: " + allRows.size());
     
      // Optionally, save all rows to a CSV.
      resultSet.setRows(allRows.toArray(new Row[] {}));
      CsvUtils.writeCsv(PqlUtils.resultSetToStringArrayList(resultSet), "cities.csv");      
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

    private ResultMessage resultMessage(List<PermissionDetails> details)
    {
        if (details.isEmpty())
            return new ResultMessage.Void();

        ResultSet result = new ResultSet(metadata);
        for (PermissionDetails pd : details)
        {
            result.addColumnValue(UTF8Type.instance.decompose(pd.username));
            result.addColumnValue(UTF8Type.instance.decompose(pd.resource.toString()));
            result.addColumnValue(UTF8Type.instance.decompose(pd.permission.toString()));
        }
        return new ResultMessage.Rows(result);
    }
View Full Code Here

    private ResultMessage resultMessage(List<PermissionDetails> details)
    {
        if (details.isEmpty())
            return new ResultMessage.Void();

        ResultSet result = new ResultSet(metadata);
        for (PermissionDetails pd : details)
        {
            result.addColumnValue(UTF8Type.instance.decompose(pd.username));
            result.addColumnValue(UTF8Type.instance.decompose(pd.resource.toString()));
            result.addColumnValue(UTF8Type.instance.decompose(pd.permission.toString()));
        }
        return new ResultMessage.Rows(result);
    }
View Full Code Here

        final int[] ttls;
        final long now;

        private ResultSetBuilder(long now)
        {
            this.resultSet = new ResultSet(getResultMetadata().copy(), new ArrayList<List<ByteBuffer>>());
            this.selectors = newSelectors();
            this.timestamps = collectTimestamps ? new long[columns.size()] : null;
            this.ttls = collectTTLs ? new int[columns.size()] : null;
            this.now = now;
        }
View Full Code Here

    private ResultMessage resultMessage(List<PermissionDetails> details)
    {
        if (details.isEmpty())
            return new ResultMessage.Void();

        ResultSet result = new ResultSet(metadata);
        for (PermissionDetails pd : details)
        {
            result.addColumnValue(UTF8Type.instance.decompose(pd.username));
            result.addColumnValue(UTF8Type.instance.decompose(pd.resource.toString()));
            result.addColumnValue(UTF8Type.instance.decompose(pd.permission.toString()));
        }
        return new ResultMessage.Rows(result);
    }
View Full Code Here

            "query", query,
            "args", Lists.newArrayList(convertedArgs));
       
        Map<Object, Object> resultAsMap =
            (Map<Object, Object>) executeMethod.execute(DriverCommand.EXECUTE_SQL, params);
        ResultSet rs = new ResultSet(((Long) resultAsMap.get("insertId")).intValue(),
            ((Long) resultAsMap.get("rowsAffected")).intValue(),
             new ResultSetRows((List<Map<String, Object>>) resultAsMap.get("rows")));
        return rs;
      }
    };
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201302.ResultSet

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.