Package com.google.api.ads.dfp.v201208

Examples of com.google.api.ads.dfp.v201208.Date


    // Create report job.
    ReportJob reportJob = new ReportJob();

    // Create report query.
    ReportQuery reportQuery = new ReportQuery();
    reportQuery.setDateRangeType(DateRangeType.CUSTOM_DATE);
    reportQuery.setStartDate(DateUtils.fromString("2011-03-01"));
    reportQuery.setEndDate(DateUtils.today("PST"));
    reportQuery.setDimensions(new Dimension[] {Dimension.ORDER, Dimension.LINE_ITEM});
    reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
        Column.AD_SERVER_CLICKS, Column.AD_SERVER_CTR,
        Column.AD_SERVER_CPM_AND_CPC_REVENUE, Column.AD_SERVER_AVERAGE_ECPM});
    reportJob.setReportQuery(reportQuery);

    System.out.println("Running report job.");
View Full Code Here


      // Create report job.
      ReportJob reportJob = new ReportJob();

      // Create report query.
      ReportQuery reportQuery = new ReportQuery();
      reportQuery.setDateRangeType(DateRangeType.LAST_MONTH);
      reportQuery.setDimensions(new Dimension[] {Dimension.ORDER});
      reportQuery.setColumns(new Column[] {Column.MERGED_AD_SERVER_IMPRESSIONS,
          Column.MERGED_AD_SERVER_CLICKS, Column.MERGED_AD_SERVER_CTR,
          Column.MERGED_AD_SERVER_CPM_AND_CPC_REVENUE, Column.MERGED_AD_SERVER_AVERAGE_ECPM});
      reportJob.setReportQuery(reportQuery);

      // Run report job.
View Full Code Here

    // Get DfpUser from "~/dfp.properties".
    DfpUser user = new DfpUser();

    // Get the ReportService.
    ReportServiceInterface reportService = user.getService(DfpService.V201208.REPORT_SERVICE);

    // Create report job.
    ReportJob reportJob = new ReportJob();

    // Create report query.
    ReportQuery reportQuery = new ReportQuery();
    reportQuery.setDateRangeType(DateRangeType.CUSTOM_DATE);
    reportQuery.setStartDate(DateUtils.fromString("2011-03-01"));
    reportQuery.setEndDate(DateUtils.today("PST"));
    reportQuery.setDimensions(new Dimension[] {Dimension.ORDER, Dimension.LINE_ITEM});
    reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
        Column.AD_SERVER_CLICKS, Column.AD_SERVER_CTR,
        Column.AD_SERVER_CPM_AND_CPC_REVENUE, Column.AD_SERVER_AVERAGE_ECPM});
    reportJob.setReportQuery(reportQuery);

    System.out.println("Running report job.");

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

    final ReportUtils reportUtils = new ReportUtils(reportService, reportJobId);

    // Change to your file location.
    final String gzCsvPath = "/path/to/filename.csv.gz";
View Full Code Here

    // Get DfpUser from "~/dfp.properties".
    DfpUser user = new DfpUser();

    // Get the ReportService.
    ReportServiceInterface reportService = user.getService(DfpService.V201208.REPORT_SERVICE);

    // Create report job.
    ReportJob reportJob = new ReportJob();

    // Create report query.
    ReportQuery reportQuery = new ReportQuery();
    reportQuery.setDateRangeType(DateRangeType.CUSTOM_DATE);
    reportQuery.setStartDate(DateUtils.fromString("2011-03-01"));
    reportQuery.setEndDate(DateUtils.today("PST"));
    reportQuery.setDimensions(new Dimension[] {Dimension.ORDER, Dimension.LINE_ITEM});
    reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
        Column.AD_SERVER_CLICKS, Column.AD_SERVER_CTR,
        Column.AD_SERVER_CPM_AND_CPC_REVENUE, Column.AD_SERVER_AVERAGE_ECPM});
    reportJob.setReportQuery(reportQuery);

    System.out.println("Running report job.");

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

    final ReportUtils reportUtils = new ReportUtils(reportService, reportJobId);

    // Change to use synchronous or asynchronous downloading.
    boolean useSynchronous = true;
View Full Code Here

      UserTeamAssociationServiceInterface userTeamAssociationService =
          user.getService(DfpService.V201208.USER_TEAM_ASSOCIATION_SERVICE);

      // Set defaults for page and filterStatement.
      UserTeamAssociationPage page = new UserTeamAssociationPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all user team associations.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get user team associations by statement.
        page = userTeamAssociationService.getUserTeamAssociationsByStatement(filterStatement);

        if (page.getResults() != null) {
View Full Code Here

      // Set the user to set to read only access within its teams.
      Long userId = Long.parseLong("INSERT_USER_ID_HERE");

      // Create filter text to select user team associations by the user ID.
      String statementText = "WHERE userId = :userId LIMIT 500";
      Statement filterStatement =
        new StatementBuilder("")
            .putValue("userId", userId)
            .toStatement();

      // Get user team associations by statement.
View Full Code Here

      // Get the current user.
      long currentUserId = userService.getCurrentUser().getId();

      // Create filter text to select user team associations by the user ID.
      String statementText = "WHERE userId = :userId LIMIT 500";
      Statement filterStatement =
        new StatementBuilder("")
            .putValue("userId", currentUserId)
            .toStatement();

      // Get user team associations by statement.
View Full Code Here

      // Set the user to remove from its teams.
      Long userId = Long.parseLong("INSERT_USER_ID_HERE");

      // Create filter text to select user team associations by the user ID.
      String statementText = "WHERE userId = :userId LIMIT 500";
      Statement filterStatement =
        new StatementBuilder("")
            .putValue("userId", userId)
            .toStatement();

      // Set defaults for page and offset.
      UserTeamAssociationPage page = new UserTeamAssociationPage();
      int offset = 0;

      do {
        // Create a statement to page through user team associations.
        filterStatement.setQuery(statementText + " OFFSET " + offset);

        // Get user team associations by statement.
        page = userTeamAssociationService.getUserTeamAssociationsByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (UserTeamAssociation userTeamAssociation : page.getResults()) {
            System.out.println(i + ") User team association between user with ID \""
                + userTeamAssociation.getUserId() + "\" and team with ID \""
                + userTeamAssociation.getTeamId() + "\" will be deleted.");
            i++;
          }
        }

        offset += 500;
      } while (offset < page.getTotalResultSetSize());

      System.out.println("Number of teams that the user will be removed from: "
          + page.getTotalResultSetSize());

      if (page.getTotalResultSetSize() > 0) {
        // Modify statement for action.
        filterStatement.setQuery("WHERE userId = :userId");

        // Create action.
        DeleteUserTeamAssociations action = new DeleteUserTeamAssociations();

        // Perform action.
View Full Code Here

   * builder.
   *
   * @return the {@link Statement}
   */
  public Statement toStatement() {
    return new Statement(query,
        MapUtils.toArray(valueMap, new String_ValueMapEntry[] {}));
  }
View Full Code Here

      // Get the TeamService.
      TeamServiceInterface teamService = user.getService(DfpService.V201208.TEAM_SERVICE);

      // Create a statement to order teams by name.
      Statement filterStatement =
          new StatementBuilder("ORDER BY name LIMIT 500")
              .toStatement();

      // Get teams by statement.
      TeamPage page = teamService.getTeamsByStatement(filterStatement);
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201208.Date

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.