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

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


          user.getService(DfpService.V201302.INVENTORY_SERVICE);

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

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


      PlacementServiceInterface placementService =
          user.getService(DfpService.V201302.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 lineItemId = Long.parseLong("INSERT_LINE_ITEM_ID_HERE");

      // Create statement text to select active LICAs for a given line item.
      String statementText = "WHERE lineItemId = :lineItemId and status = :status LIMIT 500";
      Statement filterStatement =
          new StatementBuilder("").putValue("lineItemId", lineItemId).putValue("status",
              LineItemCreativeAssociationStatus.ACTIVE.toString()).toStatement();

      // Set defaults for page and offset.
      LineItemCreativeAssociationPage page = new LineItemCreativeAssociationPage();
      int offset = 0;
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

      Date threeDaysAgo = now.getTime();

      // Create statement to only select line items for the given order that
      // have been modified in the last 3 days.
      Statement filterStatement =
          new StatementBuilder(
              "WHERE lastModifiedDateTime >= :dateTimeString AND orderId = :orderId LIMIT 500")
              .putValue("orderId", orderId)
              .putValue("dateTimeString", DATE_TIME_FORMAT.format(threeDaysAgo)).toStatement();

      // Get line items by statement.
View Full Code Here

          user.getService(DfpService.V201302.SUGGESTED_AD_UNIT_SERVICE);

      // Create statement to select all suggested ad units with 50 or more
      // requests.
      Statement filterStatement =
          new StatementBuilder("WHERE numRequests >= :numRequests").putValue("numRequests", 50L)
              .toStatement();

      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(filterStatement);
View Full Code Here

      // Set the name of the custom targeting key to delete.
      String customTargetingKeyName = "INSERT_CUSTOM_TARGETING_KEY_NAME_HERE";

      // Create statement to only select custom targeting key by the given name.
      String statementText = "WHERE name = :name";
      StatementBuilder statementBuilder = new StatementBuilder("")
          .putValue("name", customTargetingKeyName);

      // Set defaults for page and offset.
      CustomTargetingKeyPage page = new CustomTargetingKeyPage();
      int offset = 0;
      List<Long> customTargetingKeyIds = new ArrayList<Long>();

      do {
        // Create a statement to page through custom targeting keys.
        statementBuilder.setQuery(statementText + " LIMIT 500 OFFSET " + offset);

        // Get custom targeting keys by statement.
        page = customTargetingService.getCustomTargetingKeysByStatement(
            statementBuilder.toStatement());

        if (page.getResults() != null) {
          for (CustomTargetingKey customTargetingKey : page.getResults()) {
            customTargetingKeyIds.add(customTargetingKey.getId());
          }
        }

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

      System.out.println(
          "Number of custom targeting keys to be deleted: " + customTargetingKeyIds.size());

      if (customTargetingKeyIds.size() > 0) {
        // Modify statement for action.
        statementBuilder.setQuery(
            "WHERE id IN (" + StringUtils.join(customTargetingKeyIds, ",") + ")");

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

        // Perform action.
        UpdateResult result = customTargetingService.performCustomTargetingKeyAction(
            action, statementBuilder.toStatement());

        // Display results.
        if (result != null && result.getNumChanges() > 0) {
          System.out.println("Number of custom targeting keys deleted: " + result.getNumChanges());
        } else {
View Full Code Here

          user.getService(DfpService.V201302.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

          user.getService(DfpService.V201302.SUGGESTED_AD_UNIT_SERVICE);

      // Create a statement to only select suggested ad units that have more
      // than 50 requests.
      Statement filterStatement =
          new StatementBuilder("WHERE numRequests > :numRequests LIMIT 500")
              .putValue("numRequests", 50).toStatement();

      // Get suggested ad units by statement.
      SuggestedAdUnitPage page =
          suggestedAdUnitService.getSuggestedAdUnitsByStatement(filterStatement);
View Full Code Here

      // Get InventoryService.
      InventoryServiceInterface inventoryService =
          user.getService(DfpService.V201302.INVENTORY_SERVICE);

      // Create statement object to only select web ad unit sizes.
      Statement filterStatement = new StatementBuilder("WHERE targetPlatform = :targetPlatform")
          .putValue("targetPlatform", TargetPlatform.WEB.toString()).toStatement();

      // Get all ad unit sizes.
      AdUnitSize[] adUnitSizes = inventoryService.getAdUnitSizesByStatement(filterStatement);
View Full Code Here

TOP

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