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

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


      LineItemCreativeAssociationServiceInterface licaService =
          user.getService(DfpService.V201208.LINEITEMCREATIVEASSOCIATION_SERVICE);

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

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

        // Get LICAs by statement.
        page = licaService.getLineItemCreativeAssociationsByStatement(filterStatement);

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


      // Get the LabelService.
      LabelServiceInterface labelService = user.getService(DfpService.V201208.LABEL_SERVICE);

      // Create statement text to select active labels.
      Statement filterStatement = new StatementBuilder("WHERE isActive = :isActive LIMIT 500")
          .putValue("isActive", true).toStatement();

      // Get the labels by statement.
      LabelPage page =
          labelService.getLabelsByStatement(filterStatement);
View Full Code Here

      UserServiceInterface userService =
          user.getService(DfpService.V201208.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

      InventoryServiceInterface inventoryService =
          user.getService(DfpService.V201208.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

      // Get the LabelService.
      LabelServiceInterface labelService = user.getService(DfpService.V201208.LABEL_SERVICE);

      // Create a statement to select labels ordered by name.
      Statement filterStatement =
          new StatementBuilder("ORDER BY name LIMIT 500").toStatement();

      // Get labels by statement.
      LabelPage page = labelService.getLabelsByStatement(filterStatement);
View Full Code Here

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

      // Create statement text to select active LICAs for a given line item.
      String statementText = "WHERE lineItemId = :lineItemId and status = :status LIMIT 500";
      Statement filterStatement =
          new StatementBuilder("").putValue("lineItemId", lineItemId).putValue("status",
              LineItemCreativeAssociationStatus.ACTIVE.toString()).toStatement();

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

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

        // Get LICAs by statement.
        page = licaService.getLineItemCreativeAssociationsByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (LineItemCreativeAssociation lica : page.getResults()) {
            System.out.println(i + ") LICA with line item ID \"" + lica.getLineItemId()
                + "\", creative ID \"" + lica.getCreativeId() + "\", and status \""
                + lica.getStatus() + "\" will be deactivated.");
            creativeIds.add(lica.getCreativeId());
            i++;
          }
        }

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

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

      if (creativeIds.size() > 0) {
        // Modify statement for action.
        filterStatement.setQuery("WHERE lineItemId = :lineItemId and creativeId IN ("
            + StringUtils.join(creativeIds, ",") + ")");

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

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

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.