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

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


          user.getService(DfpService.V201302.CREATIVE_SERVICE);

      Long[] imageCreativeIds = new Long[] {Long.parseLong("INSERT_IMAGE_CREATIVE_ID_HERE")};

      // Create the statement to filter image creatives by id.
      StatementBuilder statementBuilder =
          new StatementBuilder("WHERE id IN ( " + StringUtils.join(imageCreativeIds, ',')
              + ") and creativeType = :creativeType LIMIT 500").putValue("creativeType",
              ImageCreative.class.getSimpleName());

      // Retrieve all creatives which match.
      CreativePage page =
          creativeService.getCreativesByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        Creative[] creatives = page.getResults();
        long[] oldIds = new long[creatives.length];
        for (int i = 0; i < creatives.length; i++) {
View Full Code Here


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

      // Create a statement to only select 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

      CreativeServiceInterface creativeService =
          user.getService(DfpService.V201302.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

      // Set the ID of the order to get line items from.
      Long orderId = Long.parseLong("INSERT_ORDER_ID_HERE");

      // Create a statement to get line items with even delivery rates.
      Statement filterStatement = new StatementBuilder(
          "WHERE deliveryRateType = :deliveryRateType AND orderId = :orderId LIMIT 500")
              .putValue("orderId", orderId)
              .putValue("deliveryRateType", DeliveryRateType.EVENLY.toString()).toStatement();

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

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

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

      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201302.THIRD_PARTY_SLOT_SERVICE);

      // Create a statement to get one active third party slot.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 1")
              .putValue("status", ThirdPartySlotStatus.ACTIVE.toString()).toStatement();

      // Get third party slot by statement.
      ThirdPartySlotPage page =
          thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);
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

      ContactServiceInterface contactService =
          user.getService(DfpService.V201302.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

      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

      // Set the ID of the activity group to get the activities for.
      Integer activityGroupId = Integer.parseInt("INSERT_ACTIVITY_GROUP_ID_HERE");

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

      // Get activities by statement.
View Full Code Here

TOP

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