Package com.google.api.ads.dfp.v201211

Examples of com.google.api.ads.dfp.v201211.Date


          " and name = :category LIMIT 1")
          .putValue("contentBrowseCustomTargetingKeyId", contentBrowseCustomTargetingKeyId)
          .putValue("category", "comedy").toStatement();

      // Get categories matching the filter statement.
      CustomTargetingValuePage customTargetingValuePage =
          customTargetingService.getCustomTargetingValuesByStatement(categoryFilterStatement);

      // Get the custom targeting value ID for the comedy category.
      long categoryCustomTargetingValueId = customTargetingValuePage.getResults()[0].getId();

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


      String statementText = "WHERE customTargetingKeyId = :customTargetingKeyId";
      StatementBuilder statementBuilder = new StatementBuilder("")
          .putValue("customTargetingKeyId", customTargetingKeyId);

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

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

        // Get custom targeting values by statement.
        page = customTargetingService.getCustomTargetingValuesByStatement(
            statementBuilder.toStatement());

        if (page.getResults() != null) {
          for (CustomTargetingValue customTargetingValue : page.getResults()) {
            customTargetingValueIds.add(customTargetingValue.getId());
          }
        }

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

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

      if (customTargetingValueIds.size() > 0) {
View Full Code Here

      Statement filterStatement =
          new StatementBuilder("WHERE customTargetingKeyId = :customTargetingKeyId LIMIT 500")
              .putValue("customTargetingKeyId", customTargetingKeyId).toStatement();

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

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (CustomTargetingValue customTargetingValue : page.getResults()) {
          System.out.println(i + ") Custom targeting value with ID \""
              + customTargetingValue.getId() + "\", name \"" + customTargetingValue.getName()
              + "\", and display name \"" + customTargetingValue.getDisplayName()
              + "\" was found.");
          i++;
        }
      }

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      Statement filterStatement =
          new StatementBuilder("WHERE customTargetingKeyId = :customTargetingKeyId LIMIT 500")
              .putValue("customTargetingKeyId", customTargetingKeyId).toStatement();

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

      if (page.getResults() != null) {
        CustomTargetingValue[] customTargetingValues = page.getResults();

        // Update each local custom targeting value object by changing its
        // display name.
        for (CustomTargetingValue customTargetingValue : customTargetingValues) {
          if (customTargetingValue.getDisplayName() == null) {
View Full Code Here

                + "\", name \"" + key.getName() + "\", display name \"" + key.getDisplayName()
                + "\", and type \"" + key.getType() + "\" was found.");


            // Sets defaults for page and filter.
            CustomTargetingValuePage valuePage = new CustomTargetingValuePage();
            Statement valueFilterStatement = new Statement();
            int valueOffset = 0;

            do {
              // Create a statement to get all custom targeting values for a
              // custom targeting key (required) by its ID.
              valueFilterStatement.setQuery("WHERE customTargetingKeyId = " + key.getId()
                  + " LIMIT 500 OFFSET " + valueOffset);

              // Get custom targeting values by statement.
              valuePage =
                  customTargetingService.getCustomTargetingValuesByStatement(valueFilterStatement);

              if (valuePage.getResults() != null) {
                int j = valuePage.getStartIndex();
                for (CustomTargetingValue value : valuePage.getResults()) {
                  System.out.println("\t" + j + ") Custom targeting value with ID \""
                      + value.getId() + "\", name \"" + value.getName() + "\", and display name \""
                      + value.getDisplayName() + "\" was found.");
                  j++;
                }
              }
              valueOffset += 500;
            } while (valuePage.getResults() != null && valuePage.getResults().length == 500);

            i++;
          }
        }
        keyOffset += 500;
View Full Code Here

   */
  public static Date fromDate(java.util.Date date) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);

    Date dfpDate = new Date();
    dfpDate.setYear(calendar.get(Calendar.YEAR));
    dfpDate.setMonth(calendar.get(Calendar.MONTH) + 1);
    dfpDate.setDay(calendar.get(Calendar.DAY_OF_MONTH));

    return dfpDate;
  }
View Full Code Here

   * @param date the DFP {@code Date} object to convert to a Java {@code Date}
   * @param timeZoneId the timezone of the date
   * @return the DFP {@code Date} object as a Java {@code Date} in the timezone
   */
  public static java.util.Date toDate(Date date, String timeZoneId) {
    return DateTimeUtils.toDate(new DateTime(date, 0, 0, 0, timeZoneId));
  }
View Full Code Here

      } else if (value instanceof String) {
        return new TextValue(null, (String) value);
      } else if (value instanceof Long) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof DateTime) {
        return new DateTimeValue(null, (DateTime) value);
      } else {
        throw new IllegalArgumentException("Unexpected Value type ["
            + value.getClass() + "]");
      }
    }
View Full Code Here

        // Modify statement for action.
        filterStatement.setQuery(
            "WHERE id IN (" + StringUtils.join(creativeWrapperIds, ",") + ")");

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

        // Perform action.
        UpdateResult result =
            creativeWrapperService.performCreativeWrapperAction(action, filterStatement);
View Full Code Here

        // 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());
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201211.Date

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.