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

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


      // Set the ID of the order to get line items from.
      Long orderId = Long.parseLong("INSERT_ORDER_ID_HERE");

      // Create a statement to get line items with even delivery rates.
      Statement filterStatement = new StatementBuilder(
          "WHERE deliveryRateType = :deliveryRateType AND orderId = :orderId LIMIT 500")
              .putValue("orderId", orderId)
              .putValue("deliveryRateType", DeliveryRateType.EVENLY.toString()).toStatement();

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


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

      // Create a statement to only select line items that need creatives from a
      // given order.
      Statement filterStatement =
          new StatementBuilder("WHERE orderId = :orderId AND status = :status LIMIT 500")
              .putValue("orderId", orderId)
              .putValue("status", ComputedStatus.NEEDS_CREATIVES.toString())
              .toStatement();

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

     
      // Create a statement to only select active third party slots.
      String statementText = "WHERE status = :status AND "
          + "companyId = :companyId LIMIT 500";
      Statement filterStatement =
          new StatementBuilder("")
            .putValue("status", ThirdPartySlotStatus.ACTIVE.toString())
            .putValue("companyId", companyId)
            .toStatement();

      // Set defaults for page and offset.
View Full Code Here

          user.getService(DfpService.V201208.THIRD_PARTY_SLOT_SERVICE);

      // Sets defaults for page and filterStatement.
      ThirdPartySlotPage page = new ThirdPartySlotPage();
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500 ").putValue("status",
              ThirdPartySlotStatus.ARCHIVED.toString()).toStatement();

      // Get third party slots by statement.
      page = thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);
View Full Code Here

      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201208.THIRD_PARTY_SLOT_SERVICE);

      // Create a statement to get one active third party slot.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 1")
              .putValue("status", ThirdPartySlotStatus.ACTIVE.toString()).toStatement();

      // Get third party slot by statement.
      ThirdPartySlotPage page =
          thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);
View Full Code Here

      PlacementServiceInterface placementService =
          user.getService(DfpService.V201208.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

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

      // Get content browse custom targeting key ID.
      long contentBrowseCustomTargetingKeyId =
          networkService.getCurrentNetwork().getContentBrowseCustomTargetingKeyId();

      // Create a statement to select the categories matching the name comedy.
      Statement categoryFilterStatement = new StatementBuilder(
          "WHERE customTargetingKeyId = :contentBrowseCustomTargetingKeyId " +
          " and name = :category LIMIT 1")
          .putValue("contentBrowseCustomTargetingKeyId", contentBrowseCustomTargetingKeyId)
          .putValue("category", "comedy").toStatement();
View Full Code Here

      long customTargetingKeyId = Long.parseLong("INSERT_CUSTOM_TARGETING_KEY_ID_HERE");

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

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

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

        // Get custom targeting values by statement.
        page = customTargetingService.getCustomTargetingValuesByStatement(
            statementBuilder.toStatement());

        if (page.getResults() != null) {
          for (CustomTargetingValue customTargetingValue : page.getResults()) {
            customTargetingValueIds.add(customTargetingValue.getId());
          }
        }

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

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

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

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

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

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

      long customTargetingKeyId = Long.parseLong("INSERT_CUSTOM_TARGETING_KEY_ID_HERE");

      // Create a statement to only select custom targeting values for a given
      // key.
      Statement filterStatement =
          new StatementBuilder("WHERE customTargetingKeyId = :customTargetingKeyId LIMIT 500")
              .putValue("customTargetingKeyId", customTargetingKeyId).toStatement();

      // Get custom targeting values by statement.
      CustomTargetingValuePage page =
          customTargetingService.getCustomTargetingValuesByStatement(filterStatement);
View Full Code Here

TOP

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