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

Examples of com.google.api.ads.dfp.axis.utils.v201302.StatementBuilder


      CreativeServiceInterface creativeService =
          user.getService(DfpService.V201311.CREATIVE_SERVICE);

      // Create a statement to get all image creatives.
      Statement filterStatement =
          new StatementBuilder("WHERE creativeType = :creativeType LIMIT 500")
              .putValue("creativeType", ImageCreative.class.getSimpleName()).toStatement();

      // Get creatives by statement.
      CreativePage page = creativeService.getCreativesByStatement(filterStatement);
View Full Code Here


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

      // Create a statement to only select line items that need creatives from a
      // given order.
      Statement filterStatement =
          new StatementBuilder("WHERE orderId = :orderId AND status = :status LIMIT 500")
              .putValue("orderId", orderId)
              .putValue("status", ComputedStatus.NEEDS_CREATIVES.toString())
              .toStatement();

      // Get line items by statement.
View Full Code Here

      long customTargetingKeyId = Long.parseLong("INSERT_CUSTOM_TARGETING_KEY_ID_HERE");

      // Create a statement to only select custom targeting values for a given
      // key.
      Statement filterStatement =
          new StatementBuilder("WHERE customTargetingKeyId = :customTargetingKeyId LIMIT 500")
              .putValue("customTargetingKeyId", customTargetingKeyId).toStatement();

      // Get custom targeting values by statement.
      CustomTargetingValuePage page =
          customTargetingService.getCustomTargetingValuesByStatement(filterStatement);
View Full Code Here

      CompanyServiceInterface companyService =
          user.getService(DfpService.V201311.COMPANY_SERVICE);

      // Create a statement to only select companies that are advertisers.
      Statement filterStatement =
          new StatementBuilder("WHERE type = :type LIMIT 500")
              .putValue("type", CompanyType.ADVERTISER.toString()).toStatement();

      // Get the companies by statement.
      CompanyPage page =
          companyService.getCompaniesByStatement(filterStatement);
View Full Code Here

      long customTargetingKeyId = Long.parseLong("INSERT_CUSTOM_TARGETING_KEY_ID_HERE");

      // Create a statement to only select predefined custom targeting values
      // for a given key.
      Statement filterStatement =
          new StatementBuilder("WHERE customTargetingKeyId = :customTargetingKeyId LIMIT 500")
              .putValue("customTargetingKeyId", customTargetingKeyId).toStatement();

      // Get custom targeting values by statement.
      CustomTargetingValuePage page =
          customTargetingService.getCustomTargetingValuesByStatement(filterStatement);
View Full Code Here

          user.getService(DfpService.V201311.CREATIVE_WRAPPER_SERVICE);

      // Create a statement to select only active creative wrappers.
      String statementText = "WHERE status = :status LIMIT 500";
      Statement filterStatement =
          new StatementBuilder(statementText)
              .putValue("status", CreativeWrapperStatus.ACTIVE.toString()).toStatement();

      // Set defaults for page and offset.
      CreativeWrapperPage page = new CreativeWrapperPage();
      int offset = 0;
View Full Code Here

      ContactServiceInterface contactService =
          user.getService(DfpService.V201311.CONTACT_SERVICE);

      // Create a statement to only select contacts that aren't invited yet.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500")
              .putValue("status", ContactStatus.UNINVITED.toString()).toStatement();

      // Get contacts by statement.
      ContactPage page = contactService.getContactsByStatement(filterStatement);
View Full Code Here

      // Set the name of the custom targeting key to delete.
      String customTargetingKeyName = "INSERT_CUSTOM_TARGETING_KEY_NAME_HERE";

      // Create statement to only select custom targeting key by the given name.
      String statementText = "WHERE name = :name";
      StatementBuilder statementBuilder = new StatementBuilder("")
          .putValue("name", customTargetingKeyName);

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

      do {
        // Create a statement to page through custom targeting keys.
        statementBuilder.setQuery(statementText + " LIMIT 500 OFFSET " + offset);

        // Get custom targeting keys by statement.
        page = customTargetingService.getCustomTargetingKeysByStatement(
            statementBuilder.toStatement());

        if (page.getResults() != null) {
          for (CustomTargetingKey customTargetingKey : page.getResults()) {
            customTargetingKeyIds.add(customTargetingKey.getId());
          }
        }

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

      System.out.println(
          "Number of custom targeting keys to be deleted: " + customTargetingKeyIds.size());

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

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

        // Perform action.
        UpdateResult result = customTargetingService.performCustomTargetingKeyAction(
            action, statementBuilder.toStatement());

        // Display results.
        if (result != null && result.getNumChanges() > 0) {
          System.out.println("Number of custom targeting keys deleted: " + result.getNumChanges());
        } else {
View Full Code Here

      // Get all activity group IDs.
      List<Integer> activityGroupIds = getAllActivityGroupIds(user);

      // Create a statement to get all activities for an activity group.
      String filterStatementString = "WHERE activityGroupId = :activityGroupId LIMIT 500 OFFSET ";
      StatementBuilder statementBuilder = new StatementBuilder(filterStatementString);

      int totalResultsCounter = 0;

      for (Integer activityGroupId : activityGroupIds) {
        // Set defaults for page.
        ActivityPage page = new ActivityPage();
        int offset = 0;

        // Default for total result set size and offset.
        int totalResultSetSize = 0;

        // Set the activity group ID to select from.
        statementBuilder.putValue("activityGroupId", activityGroupId);

        do {
          // Create a statement to get all activities from an activity group.
          statementBuilder.setQuery(filterStatementString + offset);

          // Get activities by statement.
          page = activityService.getActivitiesByStatement(statementBuilder.toStatement());

          if (page.getResults() != null) {
            totalResultSetSize = page.getTotalResultSetSize();
            for (Activity activity : page.getResults()) {
              System.out.printf(
View Full Code Here

      // Get content browse custom targeting key ID.
      long contentBrowseCustomTargetingKeyId =
          networkService.getCurrentNetwork().getContentBrowseCustomTargetingKeyId();

      // Create a statement to select the categories matching the name comedy.
      Statement categoryFilterStatement = new StatementBuilder(
          "WHERE customTargetingKeyId = :contentBrowseCustomTargetingKeyId " +
          " and name = :category LIMIT 1")
          .putValue("contentBrowseCustomTargetingKeyId", contentBrowseCustomTargetingKeyId)
          .putValue("category", "comedy").toStatement();
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.utils.v201302.StatementBuilder

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.