Package com.google.api.ads.dfp.axis.v201306

Examples of com.google.api.ads.dfp.axis.v201306.ResultSet


        .orderBy("BrowserName ASC")
        .offset(0)
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

    // Default for result sets.
    ResultSet combinedResultSet = null;
    ResultSet resultSet;
    int i = 0;

    do {
      // Get all browsers.
      resultSet = pqlService.select(statementBuilder.toStatement());

      // Combine result sets with previous ones.
      combinedResultSet = combinedResultSet == null
          ? resultSet
          : Pql.combineResultSets(combinedResultSet, resultSet);

      System.out.printf("%d) %d criteria beginning at offset %d were found.\n", i++,
          resultSet.getRows() == null ? 0 : resultSet.getRows().length,
          statementBuilder.getOffset());

      statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (resultSet.getRows() != null && resultSet.getRows().length > 0);

    // Change to your file location.
    String filePath = File.createTempFile("Browsers-", ".csv").toString();

    // Write the result set to a CSV.
View Full Code Here


    assertEquals(null, ((TextValue) Pql.createValue(null)).getValue());
  }

  @Test
  public void testGetColumnLabels() {
    ResultSet resultSet = new ResultSet();
    resultSet.setColumnTypes(new ColumnType[] {column1, column2, column3});
    assertEquals(Lists.newArrayList(new String[] {"column1", "column2", "column3"}),
        Pql.getColumnLabels(resultSet));
  }
View Full Code Here

    row2.setValues(new Value[] {textValue2, booleanValue2, numberValue2});

    Row row3 = new Row();
    row3.setValues(new Value[] {textValue3, booleanValue3, numberValue3});

    ResultSet resultSet1 = new ResultSet();
    resultSet1.setColumnTypes(new ColumnType[] {column1, column2, column3});
    resultSet1.setRows(new Row[] {row1, row2});

    ResultSet resultSet2 = new ResultSet();
    resultSet2.setColumnTypes(new ColumnType[] {column1, column2, column3});
    resultSet2.setRows(new Row[] {row3});

    ResultSet combinedResultSet = Pql.combineResultSets(resultSet1, resultSet2);

    assertEquals(3, combinedResultSet.getRows().length);
    assertArrayEquals(
        new ColumnType[] {column1, column2, column3}, combinedResultSet.getColumnTypes());
    assertArrayEquals(new Value[] {textValue1, booleanValue1, numberValue1},
        combinedResultSet.getRows()[0].getValues());
    assertArrayEquals(new Value[] {textValue2, booleanValue2, numberValue2},
        combinedResultSet.getRows()[1].getValues());
    assertArrayEquals(new Value[] {textValue3, booleanValue3, numberValue3},
        combinedResultSet.getRows()[2].getValues());
  }
View Full Code Here

    row2.setValues(new Value[] {textValue2, booleanValue2, numberValue2});

    Row row3 = new Row();
    row3.setValues(new Value[] {textValue3, booleanValue3});

    ResultSet resultSet1 = new ResultSet();
    resultSet1.setColumnTypes(new ColumnType[] {column1, column2, column3});
    resultSet1.setRows(new Row[] {row1, row2});

    ResultSet resultSet2 = new ResultSet();
    resultSet2.setColumnTypes(new ColumnType[] {column1, column2});
    resultSet2.setRows(new Row[] {row3});

    Pql.combineResultSets(resultSet1, resultSet2);
  }
View Full Code Here

    // Get the ActivityGroupService.
    ActivityGroupServiceInterface activityGroupService =
        dfpServices.get(session, ActivityGroupServiceInterface.class);

    // Get the activity group.
    ActivityGroup activityGroup = activityGroupService.getActivityGroup(activityGroupId);

    // Update the companies.
    activityGroup.setCompanyIds(
        Longs.concat(activityGroup.getCompanyIds(), new long[] {advertiserCompanyId}));

    // Update the activity group on the server.
    ActivityGroup[] activityGroups =
        activityGroupService.updateActivityGroups(new ActivityGroup[] {activityGroup});
View Full Code Here

    // Get the ActivityGroupService.
    ActivityGroupServiceInterface activityGroupService =
        dfpServices.get(session, ActivityGroupServiceInterface.class);

    // Create a short-term activity group.
    ActivityGroup shortTermActivityGroup = new ActivityGroup();
    shortTermActivityGroup.setName(
        "Short-term activity group #" + new Random().nextInt(Integer.MAX_VALUE));
    shortTermActivityGroup.setCompanyIds(new long[] {advertiserCompanyId});
    shortTermActivityGroup.setClicksLookback(1);
    shortTermActivityGroup.setImpressionsLookback(1);

    // Create a long-term activity group.
    ActivityGroup longTermActivityGroup = new ActivityGroup();
    longTermActivityGroup.setName(
        "Long-term activity group #" + new Random().nextInt(Integer.MAX_VALUE));
    longTermActivityGroup.setCompanyIds(new long[] {advertiserCompanyId});
    longTermActivityGroup.setClicksLookback(30);
    longTermActivityGroup.setImpressionsLookback(30);

    // Create the activity groups on the server.
    ActivityGroup[] activityGroups = activityGroupService.createActivityGroups(
        new ActivityGroup[] {shortTermActivityGroup, longTermActivityGroup});
View Full Code Here

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get activity groups by statement.
      ActivityGroupPage page =
          activityGroupService.getActivityGroupsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (ActivityGroup activityGroup : page.getResults()) {
          System.out.printf(
              "%d) Activity group with ID \"%d\" and name \"%s\" was found.\n", i++,
              activityGroup.getId(), activityGroup.getName());
        }
      }
View Full Code Here

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get activity groups by statement.
      ActivityGroupPage page =
          activityGroupService.getActivityGroupsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (ActivityGroup activityGroup : page.getResults()) {
          System.out.printf(
              "%d) Activity group with ID \"%d\" and name \"%s\" was found.\n", i++,
              activityGroup.getId(), activityGroup.getName());
        }
      }
View Full Code Here

*/
public class GetActiveActivityGroups {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the ActivityGroupService.
    ActivityGroupServiceInterface activityGroupService =
        dfpServices.get(session, ActivityGroupServiceInterface.class);

    // Create a statement to only select active activity groups.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("status = :status")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("status", ActivityGroupStatus.ACTIVE.toString());

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get activity groups by statement.
      ActivityGroupPage page =
          activityGroupService.getActivityGroupsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (ActivityGroup activityGroup : page.getResults()) {
View Full Code Here

*/
public class GetAllActivityGroups {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the ActivityGroupService.
    ActivityGroupServiceInterface activityGroupService =
        dfpServices.get(session, ActivityGroupServiceInterface.class);

    // Create a statement to get all activity groups.
    StatementBuilder statementBuilder = new StatementBuilder()
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

    // Default for total result set size.
    int totalResultSetSize = 0;

    do {
      // Get activity groups by statement.
      ActivityGroupPage page =
          activityGroupService.getActivityGroupsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (ActivityGroup activityGroup : page.getResults()) {
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.v201306.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.