Package com.google.api.ads.dfp.lib.utils.v201306

Examples of com.google.api.ads.dfp.lib.utils.v201306.StatementBuilder


      // Set the ID of the activity group to get the activities for.
      Integer activityGroupId = Integer.parseInt("INSERT_ACTIVITY_GROUP_ID_HERE");

      // Create a statement to only select active activities.
      Statement filterStatement =
          new StatementBuilder(
              "WHERE activityGroupId = :activityGroupId and status = :status LIMIT 500")
              .putValue("activityGroupId", activityGroupId)
              .putValue("status", ActivityStatus.ACTIVE.toString()).toStatement();

      // Get activities by statement.
View Full Code Here


      int offset = 0;

      // Create a statement to only select line items from a given order.
      String filterText = "WHERE orderId = :orderId LIMIT 500";
      Statement filterStatement =
          new StatementBuilder(filterText).putValue("orderId", orderId).toStatement();

      // Collect all line item custom field IDs for an order.
      Set<Long> customFieldIds = new HashSet<Long>();
      do {
        filterStatement.setQuery(filterText + " OFFSET " + offset);

        // Get line items by statement.
        page = lineItemService.getLineItemsByStatement(filterStatement);

        // Get custom field IDs from the line items of an order.
        if (page.getResults() != null) {
          for (LineItem lineItem : page.getResults()) {
            if (lineItem.getCustomFieldValues() != null) {
              for (BaseCustomFieldValue customFieldValue : lineItem.getCustomFieldValues()) {
                customFieldIds.add(customFieldValue.getCustomFieldId());
              }
            }
          }
        }

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

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

      // Create statement to filter for an order.
      filterStatement =
          new StatementBuilder("WHERE ORDER_ID = :orderId").putValue("orderId", orderId)
              .toStatement();

      // Create report job.
      ReportJob reportJob = new ReportJob();
View Full Code Here

      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.
      UserTeamAssociationPage page =
View Full Code Here

      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.
      UserTeamAssociationPage page =
View Full Code Here

      PlacementServiceInterface placementService =
          user.getService(DfpService.V201311.PLACEMENT_SERVICE);

      // Create a statement to only select active placements.
      Statement filterStatement =
        new StatementBuilder("WHERE status = :status LIMIT 500")
            .putValue("status", InventoryStatus.ACTIVE.toString()).toStatement();

      // Get placements by statement.
      PlacementPage page = placementService.getPlacementsByStatement(filterStatement);
View Full Code Here

      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();
View Full Code Here

          user.getService(DfpService.V201311.PLACEMENT_SERVICE);

      // Create statement text to select active placements.
      String statementText = "WHERE status = :status LIMIT 500";
      Statement filterStatement =
          new StatementBuilder("")
              .putValue("status", InventoryStatus.ACTIVE.toString())
              .toStatement();

      // Set defaults for page and offset.
      PlacementPage page = new PlacementPage();
View Full Code Here

      Long orderId = Long.parseLong("INSERT_ORDER_ID_HERE");

      // Create statement to filter for an order.
      Statement filterStatement =
          new StatementBuilder("WHERE ORDER_ID = :id").putValue("id", orderId).toStatement();

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

      // Create report query.
View Full Code Here

      Long userId = Long.parseLong("INSERT_USER_ID_HERE");

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

      // Set defaults for page and offset.
      UserPage page = new UserPage();
View Full Code Here

      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.
View Full Code Here

TOP

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