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

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


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

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

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

        // Get ad units by statement.
        page = inventoryService.getAdUnitsByStatement(filterStatement);

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


      PlacementServiceInterface placementService =
          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();
      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

      // Get the OrderService.
      OrderServiceInterface orderService =
          user.getService(DfpService.V201302.ORDER_SERVICE);

      // Create a statement to get all orders.
      Statement filterStatement = new Statement("LIMIT 500", null);

      // Get orders by statement.
      OrderPage page = orderService.getOrdersByStatement(filterStatement);

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

      SuggestedAdUnitServiceInterface suggestedAdUnitService =
          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 =
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

      SuggestedAdUnitServiceInterface suggestedAdUnitService =
          user.getService(DfpService.V201302.SUGGESTED_AD_UNIT_SERVICE);

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

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

        // Get suggested ad units by statement.
        page = suggestedAdUnitService.getSuggestedAdUnitsByStatement(filterStatement);

        if (page.getResults() != null) {
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

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

      bannerAdUnitPlacement.setTargetedAdUnitIds(new String[] {});

      List<Placement> placementList = new ArrayList<Placement>();

      // Get the first 500 ad units.
      AdUnitPage page = inventoryService.getAdUnitsByStatement(new Statement("LIMIT 500", null));

      // Separate the ad units by size.
      if (page.getResults() != null) {
        for (AdUnit adUnit : page.getResults()) {
          if (adUnit.getParentId() != null && adUnit.getAdUnitSizes() != null) {
View Full Code Here

      // Get the PlacementService.
      PlacementServiceInterface placementService =
          user.getService(DfpService.V201302.PLACEMENT_SERVICE);

      // Create a statement to select first 500 placements.
      Statement filterStatement = new Statement("LIMIT 500", null);

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

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

TOP

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