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

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


      CustomFieldServiceInterface customFieldService =
          user.getService(DfpService.V201302.CUSTOM_FIELD_SERVICE);

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

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

        // Get custom fields by statement.
        page = customFieldService.getCustomFieldsByStatement(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

      LineItemServiceInterface lineItemService =
          user.getService(DfpService.V201302.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

      // Create statement to select only active custom fields that apply to
      // line items.
      String statementText =
          "WHERE entityType = :entityType and isActive = :isActive LIMIT 500";
      Statement filterStatement =
          new StatementBuilder(statementText)
              .putValue("entityType", CustomFieldEntityType.LINE_ITEM.toString())
              .putValue("isActive", true)
              .toStatement();

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

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

        // Get custom fields by statement.
        page = customFieldService.getCustomFieldsByStatement(filterStatement);

        if (page.getResults() != null) {
          for (CustomField customField : page.getResults()) {
            System.out.println(i + ") Custom field with ID \""
                + customField.getId() + "\" and name \"" + customField.getName()
                + "\" will be deactivated.");
            customFieldIds.add(customField.getId());
            i++;
          }
        }

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

      System.out.println("Number of custom fields to be deactivated: " + customFieldIds.size());

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

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

        // Perform action.
View Full Code Here

      // Get UserService.
      UserServiceInterface userService =
          user.getService(DfpService.V201302.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

      // Get the ActivityGroupService.
      ActivityGroupServiceInterface activityGroupService =
          user.getService(DfpService.V201302.ACTIVITY_GROUP_SERVICE);

      // Create a statement to only select active activity groups.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500")
              .putValue("status", ActivityGroupStatus.ACTIVE.toString()).toStatement();

      // Get activity groups by statement.
      ActivityGroupPage page = activityGroupService.getActivityGroupsByStatement(filterStatement);
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

      // Get the ContentService.
      ContentServiceInterface contentService = user.getService(DfpService.V201302.CONTENT_SERVICE);

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

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

        // Get content by statement.
        page = contentService.getContentByStatement(filterStatement);

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

      UserTeamAssociationServiceInterface userTeamAssociationService =
          user.getService(DfpService.V201302.USER_TEAM_ASSOCIATION_SERVICE);

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

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

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

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

      // Set the line item to get LICAs by.
      Long lineItemId = Long.parseLong("INSERT_LINE_ITEM_ID_HERE");

      // Create a statement to only select LICAs for the given lineItem ID.
      Statement filterStatement =
          new StatementBuilder("WHERE lineItemId = :lineItemId LIMIT 500")
              .putValue("lineItemId", lineItemId).toStatement();

      // Get LICAs by statement.
      LineItemCreativeAssociationPage page =
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.