Package com.google.api.ads.dfp.axis.v201306

Examples of com.google.api.ads.dfp.axis.v201306.NumberValue


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

    do {
      // Get content by statement.
      ContentPage page =
          contentService.getContentByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Content content : page.getResults()) {
          System.out.printf(
              "%d) Content with ID \"%d\" and name \"%s\" was found.\n", i++,
              content.getId(), content.getName());
        }
      }
View Full Code Here


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

    do {
      // Get content by statement.
      ContentPage page = contentService.getContentByStatementAndCustomTargetingValue(
          statementBuilder.toStatement(), categoryCustomTargetingValueId);

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Content content : page.getResults()) {
          System.out.printf(
              "%d) Content with ID \"%d\" and name \"%s\" was found.\n", i++,
              content.getId(), content.getName());
        }
      }
View Full Code Here

*/
public class GetAllContent {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the ContentService.
    ContentServiceInterface contentService =
        dfpServices.get(session, ContentServiceInterface.class);

    // Create a statement to get all content.
    StatementBuilder statementBuilder = new StatementBuilder()
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

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

    do {
      // Get content by statement.
      ContentPage page =
          contentService.getContentByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (Content content : page.getResults()) {
View Full Code Here

*/
public class GetComedyContent {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the ContentService.
    ContentServiceInterface contentService =
        dfpServices.get(session, ContentServiceInterface.class);

    // Get the CustomTargetingService.
    CustomTargetingServiceInterface customTargetingService =
        dfpServices.get(session, CustomTargetingServiceInterface.class);

    // Get the NetworkService.
    NetworkServiceInterface networkService =
        dfpServices.get(session, NetworkServiceInterface.class);

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

    if (contentBrowseCustomTargetingKeyId == 0) {
      throw new RuntimeException("Your network does not have content categories enabled.");     
    }

    // Create a statement to select the categories matching the name comedy.
    Statement categoryFilterStatement = new StatementBuilder()
        .where("customTargetingKeyId = :contentBrowseCustomTargetingKeyId and name = :category")
        .limit(1)
        .withBindVariableValue(
            "contentBrowseCustomTargetingKeyId", contentBrowseCustomTargetingKeyId)
        .withBindVariableValue("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();

    // Create a statement to select all content.
    StatementBuilder statementBuilder = new StatementBuilder()
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

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

    do {
      // Get content by statement.
      ContentPage page = contentService.getContentByStatementAndCustomTargetingValue(
          statementBuilder.toStatement(), categoryCustomTargetingValueId);

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
View Full Code Here

    // Get the CreativeWrapperService.
    CreativeWrapperServiceInterface creativeWrapperService =
        dfpServices.get(session, CreativeWrapperServiceInterface.class);

    // Get the creative wrapper.
    CreativeWrapper creativeWrapper = creativeWrapperService.getCreativeWrapper(creativeWrapperId);

    // Update the creative wrapper ordering.
    creativeWrapper.setOrdering(CreativeWrapperOrdering.OUTER);

    // Update the creative wrapper on the server.
    CreativeWrapper[] creativeWrappers =
        creativeWrapperService.updateCreativeWrappers(new CreativeWrapper[] {creativeWrapper});
View Full Code Here

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

    do {
      // Get creative wrappers by statement.
      CreativeWrapperPage page =
          creativeWrapperService.getCreativeWrappersByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (CreativeWrapper creativeWrapper : page.getResults()) {
          System.out.printf(
              "%d) Creative wrapper with ID \"%d\" applying to label \"%d\" was found.\n", i++,
              creativeWrapper.getId(), creativeWrapper.getLabelId());
        }
      }
View Full Code Here

  private static final String CREATIVE_WRAPPER_ID = "INSERT_CREATIVE_WRAPPER_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session, long creativeWrapperId)
      throws Exception {
    // Get the CreativeWrapperService.
    CreativeWrapperServiceInterface creativeWrapperService =
        dfpServices.get(session, CreativeWrapperServiceInterface.class);

    // Get the creative wrapper.
    CreativeWrapper creativeWrapper = creativeWrapperService.getCreativeWrapper(creativeWrapperId);

    // Update the creative wrapper ordering.
    creativeWrapper.setOrdering(CreativeWrapperOrdering.OUTER);

    // Update the creative wrapper on the server.
    CreativeWrapper[] creativeWrappers =
        creativeWrapperService.updateCreativeWrappers(new CreativeWrapper[] {creativeWrapper});

    for (CreativeWrapper updatedCreativeWrapper : creativeWrappers) {
      System.out.printf(
          "Creative wrapper with ID \"%d\" and wrapping order \"%s\" was updated.\n",
          updatedCreativeWrapper.getId(), updatedCreativeWrapper.getOrdering());
View Full Code Here

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

    do {
      // Get custom fields by statement.
      CustomFieldPage page =
          customFieldService.getCustomFieldsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (CustomField customField : page.getResults()) {
          System.out.printf(
              "%d) Custom field with ID \"%d\" will be deactivated.\n", i++, customField.getId());
        }
      }
View Full Code Here

  private static final String CUSTOM_FIELD_ID = "INSERT_CUSTOM_FIELD_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session, long customFieldId)
      throws Exception {
    // Get the CustomFieldService.
    CustomFieldServiceInterface customFieldService =
        dfpServices.get(session, CustomFieldServiceInterface.class);

    // Create a statement to select a custom field.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("WHERE id = :id")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("id", customFieldId);

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

    do {
      // Get custom fields by statement.
      CustomFieldPage page =
          customFieldService.getCustomFieldsByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        totalResultSetSize = page.getTotalResultSetSize();
        int i = page.getStartIndex();
        for (CustomField customField : page.getResults()) {
          System.out.printf(
              "%d) Custom field with ID \"%d\" will be deactivated.\n", i++, customField.getId());
        }
      }

      statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
    } while (statementBuilder.getOffset() < totalResultSetSize);

    System.out.printf("Number of custom fields to be deactivated: %d\n", totalResultSetSize);

    if (totalResultSetSize > 0) {
      // Remove limit and offset from statement.
      statementBuilder.removeLimitAndOffset();

      // Create action.
      com.google.api.ads.dfp.axis.v201306.DeactivateCustomFields action =
          new com.google.api.ads.dfp.axis.v201306.DeactivateCustomFields();

      // Perform action.
      UpdateResult result = customFieldService.performCustomFieldAction(
          action, statementBuilder.toStatement());

      if (result != null && result.getNumChanges() > 0) {
        System.out.printf("Number of custom fields deactivated: %d\n", result.getNumChanges());
      } else {
View Full Code Here

  public static void runExample(DfpServices dfpServices, DfpSession session,
      long numberCustomFieldId, long customFieldOptionId, long lineItemId)
      throws Exception {
    // Get the CustomFieldService.
    CustomFieldServiceInterface customFieldService =
        dfpServices.get(session, CustomFieldServiceInterface.class);

    // Get the LineItemService.
    LineItemServiceInterface lineItemService =
        dfpServices.get(session, LineItemServiceInterface.class);

    // Get the drop-down custom field ID.
    long dropDownCustomFieldId =
        customFieldService.getCustomFieldOption(customFieldOptionId).getCustomFieldId();

    // Get the line item.
    LineItem lineItem = lineItemService.getLineItem(lineItemId);

    // Create number custom field value.
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.v201306.NumberValue

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.