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

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


      // 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


      // Set the ID of the order to get line items from.
      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();
View Full Code Here

      Long companyId = Long.parseLong("INSERT_COMPANY_ID_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.
      ThirdPartySlotPage page = new ThirdPartySlotPage();
      int offset = 0;
      int i = 0;
      List<Long> thirdPartySlotIds = new ArrayList<Long>();

      do {
        // Create a statement to page through active third party slots.
        filterStatement.setQuery(statementText + " OFFSET " + offset);

        // Get third party slots by statement.
        page = thirdpartySlotService.getThirdPartySlotsByStatement(filterStatement);

        if (page.getResults() != null) {
          for (ThirdPartySlot thirdPartySlot : page.getResults()) {
            System.out.println("Third party slot with ID \"" + thirdPartySlot.getId()
                + "\" will be archived.");
            thirdPartySlotIds.add(thirdPartySlot.getId());
          }
        }

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

      System.out.println("Number of third party slots to be archived: "
          + thirdPartySlotIds.size());

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

        // Create action.
        ArchiveThirdPartySlots action = new ArchiveThirdPartySlots();
View Full Code Here

      ThirdPartySlotServiceInterface thirdPartySlotService =
          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

      LineItemServiceInterface lineItemService =
          user.getService(DfpService.V201208.LINEITEM_SERVICE);

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

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

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

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

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

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

      do {
        // Create a statement to get third party slots.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

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

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

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

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

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

        // Get ad units by filter.
        page = placementService.getPlacementsByStatement(filterStatement);

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

      // Get the ThirdPartySlotService.
      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 =
View Full Code Here

      // Get the PlacementService.
      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

      PlacementServiceInterface placementService =
          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();
      int offset = 0;
      List<Long> placementIds = new ArrayList<Long>();

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

        // Get placements by statement.
        page = placementService.getPlacementsByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Placement placement : page.getResults()) {
            System.out.println(i + ") Placement with ID \"" + placement.getId()
                + "\", name \"" + placement.getName()
                + "\", and status \"" + placement.getStatus() + "\" will be deactivated.");
            placementIds.add(placement.getId());
            i++;
          }
        }

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

      System.out.println("Number of placements to be deactivated: " + placementIds.size());

      // Modify statement for action.
      filterStatement.setQuery("WHERE id IN (" + StringUtils.join(placementIds, ",") + ")");

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

      // Perform action.
View Full Code Here

TOP

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

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.