Package com.google.api.ads.dfp.axis.utils.v201308

Examples of com.google.api.ads.dfp.axis.utils.v201308.StatementBuilder


    // Run report job.
    reportJob = reportService.runReportJob(reportJob);

    // Create report downloader.
    ReportDownloader reportDownloader = new ReportDownloader(reportService, reportJob.getId());

    // Wait for the report to be ready.
    reportDownloader.waitForReportReady();

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

    System.out.printf("Downloading report to %s ...", filePath);

    // Download the report.
    reportDownloader.downloadReport(ExportFormat.CSV_DUMP, filePath);

    System.out.println("done.");
  }
View Full Code Here


    // Run report job.
    reportJob = reportService.runReportJob(reportJob);

    // Create report downloader.
    ReportDownloader reportDownloader = new ReportDownloader(reportService, reportJob.getId());

    // Wait for the report to be ready.
    reportDownloader.waitForReportReady();

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

    System.out.printf("Downloading report to %s ...", filePath);

    // Download the report.
    reportDownloader.downloadReport(ExportFormat.CSV_DUMP, filePath);

    System.out.println("done.");
  }
View Full Code Here

    // Run report job.
    reportJob = reportService.runReportJob(reportJob);

    // Create report downloader.
    ReportDownloader reportDownloader = new ReportDownloader(reportService, reportJob.getId());

    // Wait for the report to be ready.
    reportDownloader.waitForReportReady();

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

    System.out.printf("Downloading report to %s ...", filePath);

    // Download the report.
    reportDownloader.downloadReport(ExportFormat.CSV_DUMP, filePath);

    System.out.println("done.");
  }
View Full Code Here

    // Run report job.
    reportJob = reportService.runReportJob(reportJob);

    // Create report downloader.
    final ReportDownloader reportDownloader =
        new ReportDownloader(reportService, reportJob.getId());

    reportDownloader.whenReportReady(new ReportCallback() {
      public void onSuccess() {
        try {
          // Change to your file location.
          String filePath = File.createTempFile("async-report-", ".csv.gz").toString();

          System.out.printf("Downloading report to %s ...", filePath);

          // Download the report.
          reportDownloader.downloadReport(ExportFormat.CSV_DUMP, filePath);

          System.out.println("done.");
        } catch (IOException e) {
          e.printStackTrace();
        }
View Full Code Here

    // Run report job.
    reportJob = reportService.runReportJob(reportJob);

    // Create report downloader.
    ReportDownloader reportDownloader = new ReportDownloader(reportService, reportJob.getId());

    // Wait for the report to be ready.
    reportDownloader.waitForReportReady();

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

    System.out.printf("Downloading report to %s ...", filePath);

    // Download the report.
    reportDownloader.downloadReport(ExportFormat.CSV_DUMP, filePath);

    System.out.println("done.");
  }
View Full Code Here

    // Run report job.
    reportJob = reportService.runReportJob(reportJob);

    // Create report downloader.
    ReportDownloader reportDownloader = new ReportDownloader(reportService, reportJob.getId());

    // Wait for the report to be ready.
    reportDownloader.waitForReportReady();

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

    System.out.printf("Downloading report to %s ...", filePath);

    // Download the report.
    reportDownloader.downloadReport(ExportFormat.CSV_DUMP, filePath);

    System.out.println("done.");
  }
View Full Code Here

      throws Exception {
    // Get the ReportService.
    ReportServiceInterface reportService = dfpServices.get(session, ReportServiceInterface.class);

    // Create statement to filter for an order.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("ORDER_ID = :orderId")
        .withBindVariableValue("orderId", orderId);

    // Create report query.
    ReportQuery reportQuery = new ReportQuery();
    reportQuery.setDimensions(new Dimension[] {Dimension.DATE, Dimension.ORDER_ID});
    reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
        Column.AD_SERVER_CLICKS, Column.AD_SERVER_CTR,
        Column.AD_SERVER_CPM_AND_CPC_REVENUE});
    reportQuery.setDimensionAttributes(new DimensionAttribute[] {
        DimensionAttribute.ORDER_TRAFFICKER, DimensionAttribute.ORDER_START_DATE_TIME,
        DimensionAttribute.ORDER_END_DATE_TIME});

    // Set the filter statement.
    reportQuery.setStatement(statementBuilder.toStatement());

    // Set the start and end dates or choose a dynamic date range type.
    reportQuery.setDateRangeType(DateRangeType.CUSTOM_DATE);
    reportQuery.setStartDate(
        DateTimes.toDateTime("2013-05-01T00:00:00", "America/New_York").getDate());
View Full Code Here

    // Get the CreativeWrapperService.
    CreativeWrapperServiceInterface creativeWrapperService =
        dfpServices.get(session, CreativeWrapperServiceInterface.class);

    // Create a statement to select all creative wrappers.
    StatementBuilder statementBuilder = new StatementBuilder()
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

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

    do {
      // Get creative wrappers by statement.
      CreativeWrapperPage page =
          creativeWrapperService.getCreativeWrappersByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (CreativeWrapper creativeWrapper : page.getResults()) {
          System.out.printf(
              "%d) Creative wrapper with ID \"%d\" applying to label \"%d\" was found.\n", i++,
              creativeWrapper.getId(), creativeWrapper.getLabelId());
        }
      }

      statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);

    System.out.printf("Number of results found: %d\n", totalResultSetSize);
  }
View Full Code Here

    // Get the LineItemCreativeAssociationService.
    LineItemCreativeAssociationServiceInterface licaService =
        dfpServices.get(session, LineItemCreativeAssociationServiceInterface.class);

    // Create a statement to all LICAs for a line item.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("WHERE lineItemId = :lineItemId ")
        .orderBy("lineItemId ASC, creativeId ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("lineItemId", lineItemId);

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

    do {
      // Get LICAs by statement.
      LineItemCreativeAssociationPage page =
          licaService.getLineItemCreativeAssociationsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (LineItemCreativeAssociation lica : page.getResults()) {
          if (lica.getCreativeSetId() != null) {
            System.out.printf(
                "%d) LICA with line item ID \"%d\" and creative set ID \"%d\" was found.\n", i++,
                lica.getLineItemId(), lica.getCreativeSetId());
          } else {
            System.out.printf(
                "%d) LICA with line item ID \"%d\" and creative ID \"%d\" was found.\n", i++,
                lica.getLineItemId(), lica.getCreativeId());
          }
        }
      }

      statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);

    System.out.printf("Number of results found: %d\n", totalResultSetSize);
  }
View Full Code Here

    // 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()) {
          System.out.printf(
              "%d) Activity group with ID \"%d\" and name \"%s\" was found.\n", i++,
              activityGroup.getId(), activityGroup.getName());
        }
      }

      statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);

    System.out.printf("Number of results found: %d\n", totalResultSetSize);
  }
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.utils.v201308.StatementBuilder

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.