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

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


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

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

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

        // Get creatives by statement.
        page = creativeService.getCreativesByStatement(filterStatement);

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


      // Get the ContentService.
      ContentServiceInterface contentService = user.getService(DfpService.V201208.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

      // Get the CustomTargetingService.
      CustomTargetingServiceInterface customTargetingService =
          user.getService(DfpService.V201208.CUSTOM_TARGETING_SERVICE);

      // Create a statement to only select predefined custom targeting keys.
      Statement filterStatement = new StatementBuilder("WHERE type = :type LIMIT 500").putValue(
          "type", CustomTargetingKeyType.PREDEFINED.toString()).toStatement();

      // Get custom targeting keys by statement.
      CustomTargetingKeyPage page =
          customTargetingService.getCustomTargetingKeysByStatement(filterStatement);
View Full Code Here

      ReportServiceInterface reportService = user.getService(DfpService.V201208.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

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

      // Create a statement to only select line items from the specified order
      // that are in the approved (needs creatives) state.
      String statementText = "WHERE orderID = :orderId and status = :status LIMIT 500";
      Statement filterStatement =
          new StatementBuilder("")
              .putValue("orderId", orderId)
              .putValue("status", ComputedStatus.NEEDS_CREATIVES.toString())
              .toStatement();

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

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

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

        if (page.getResults() != null) {
          for (LineItemSummary lineItem : page.getResults()) {
            // Archived line items cannot be activated.
            if (!lineItem.getIsArchived()) {
              System.out.println(i + ") Line item with ID \""
                  + lineItem.getId() + "\", belonging to order ID \""
                  + lineItem.getOrderId() + "\", and name \"" + lineItem.getName()
                  + "\" will be activated.");
              lineItemIds.add(lineItem.getId());
              i++;
            }
          }
        }

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

      System.out.println("Number of line items to be activated: " + lineItemIds.size());

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

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

        // Perform action.
View Full Code Here

      // Get the CustomTargetingService.
      CustomTargetingServiceInterface customTargetingService =
          user.getService(DfpService.V201208.CUSTOM_TARGETING_SERVICE);

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

      // Get custom targeting keys by statement.
      CustomTargetingKeyPage page =
          customTargetingService.getCustomTargetingKeysByStatement(filterStatement);
View Full Code Here

      now.add(Calendar.DATE, -3);
      Date threeDaysAgo = now.getTime();

      // Create statement to only select line items for the given order that
      // have been modified in the last 3 days.
      Statement filterStatement =
          new StatementBuilder(
              "WHERE lastModifiedDateTime >= :dateTimeString AND orderId = :orderId LIMIT 500")
              .putValue("orderId", orderId)
              .putValue("dateTimeString", DATE_TIME_FORMAT.format(threeDaysAgo)).toStatement();
View Full Code Here

      // for.
      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 =
View Full Code Here

      // Get the CreativeTemplateService.
      CreativeTemplateServiceInterface creativeTemplateService =
          user.getService(DfpService.V201208.CREATIVE_TEMPLATE_SERVICE);

      // Create a statement to only select system defined creative templates.
      Statement filterStatement =
          new StatementBuilder("WHERE type = :creativeTemplateType LIMIT 500").putValue(
              "creativeTemplateType", CreativeTemplateType.SYSTEM_DEFINED.toString()).toStatement();

      // Get creative templates by statement.
      CreativeTemplatePage page =
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.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.