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

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


      LineItemPage page = new LineItemPage();
      int offset = 0;

      // Create a statement to only select line items from a given order.
      String filterText = "WHERE orderId = :orderId LIMIT 500";
      Statement filterStatement =
          new StatementBuilder(filterText).putValue("orderId", orderId).toStatement();

      // Collect all line item custom field IDs for an order.
      Set<Long> customFieldIds = new HashSet<Long>();
      do {
        filterStatement.setQuery(filterText + " OFFSET " + offset);

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

        // Get custom field IDs from the line items of an order.
View Full Code Here


      ReportServiceInterface reportService = user.getService(DfpService.V201211.REPORT_SERVICE);

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

      // Create statement to filter for an order.
      Statement filterStatement =
          new StatementBuilder("WHERE ORDER_ID = :id").putValue("id", orderId).toStatement();

      // Create report job.
      ReportJob reportJob = new ReportJob();
View Full Code Here

      UserServiceInterface userService =
          user.getService(DfpService.V201211.USER_SERVICE);

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

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

        // Get users by statement.
        page = userService.getUsersByStatement(filterStatement);

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

      // Get UserService.
      UserServiceInterface userService =
          user.getService(DfpService.V201211.USER_SERVICE);

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

      // Get users by statement.
      UserPage page = userService.getUsersByStatement(filterStatement);

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

      // Set the ID of the user to deactivate
      Long userId = Long.parseLong("INSERT_USER_ID_HERE");

      // Create filter text to select user by id.
      String statementText = "WHERE id = :userId LIMIT 500";
      Statement filterStatement =
        new StatementBuilder("")
            .putValue("userId", userId)
            .toStatement();

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

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

        // Get users by statement.
        page = userService.getUsersByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (User userResult : page.getResults()) {
            System.out.println(i + ") User with ID \"" + userResult.getId()
                + "\", email \"" + userResult.getEmail()
                + "\", and status \"" + (userResult.getIsActive() ? "ACTIVE" : "INACTIVE")
                + "\" will be deactivated.");
            userIds.add(userResult.getId());
            i++;
          }
        }

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

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

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

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

        // Perform action.
View Full Code Here

      // Get UserService.
      UserServiceInterface userService =
          user.getService(DfpService.V201211.USER_SERVICE);

      // Create a statement to get all users sorted by name.
      Statement filterStatement = new Statement("ORDER BY name LIMIT 500", null);

      // Get users by statement.
      UserPage page = userService.getUsersByStatement(filterStatement);

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

      AudienceSegmentServiceInterface audienceSegmentService =
          user.getService(DfpService.V201211.AUDIENCE_SEGMENT_SERVICE);

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

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

        // Get audience segments by statement.
        page = audienceSegmentService.getAudienceSegmentsByStatement(filterStatement);

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

      // Get InventoryService.
      InventoryServiceInterface inventoryService =
          user.getService(DfpService.V201308.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

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

    // Sets defaults for page and filterStatement.
    AdUnitPage page = new AdUnitPage();
    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 statement.
      page = inventoryService.getAdUnitsByStatement(filterStatement);

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

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

    // Create a statement to only select the root ad unit.
    Statement filterStatement = new Statement("WHERE parentId IS NULL LIMIT 500", null);

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