Package com.google.api.ads.dfp.v201211

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


      SuggestedAdUnitServiceInterface suggestedAdUnitService =
          user.getService(DfpService.V201211.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


      // Set the user to set to read only access within its teams.
      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.
View Full Code Here

      // Set the ID of the master creative to get creative sets for.
      Long masterCreativeId = Long.parseLong("INSERT_MASTER_CREATIVE_ID_HERE");

      // Create statement object to only select creative sets that have the
      // given master creative.
      Statement filterStatement =
          new StatementBuilder("WHERE masterCreativeId = :masterCreativeId LIMIT 500")
              .putValue("masterCreativeId", masterCreativeId).toStatement();

      // Get creative sets by statement.
      CreativeSetPage page = creativeSetService.getCreativeSetsByStatement(filterStatement);
View Full Code Here

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

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

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

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

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

      // Set the user to remove from its teams.
      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();
      int offset = 0;

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

        // Get user team associations by statement.
        page = userTeamAssociationService.getUserTeamAssociationsByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (UserTeamAssociation userTeamAssociation : page.getResults()) {
            System.out.println(i + ") User team association between user with ID \""
                + userTeamAssociation.getUserId() + "\" and team with ID \""
                + userTeamAssociation.getTeamId() + "\" will be deleted.");
            i++;
          }
        }

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

      System.out.println("Number of teams that the user will be removed from: "
          + page.getTotalResultSetSize());

      if (page.getTotalResultSetSize() > 0) {
        // Modify statement for action.
        filterStatement.setQuery("WHERE userId = :userId");

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

        // Perform action.
View Full Code Here

      // Get the effective root ad unit ID of the network.
      String effectiveRootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

      // Create a statement to select the children of the effective root ad
      // unit.
      Statement filterStatement = new StatementBuilder("WHERE parentId = :id LIMIT 500")
          .putValue("id", effectiveRootAdUnitId).toStatement();

      // Get ad units by statement.
      AdUnitPage page = inventoryService.getAdUnitsByStatement(filterStatement);
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.V201211.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.V201211.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

TOP

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