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

Examples of com.google.api.ads.dfp.v201302.DropDownCustomField


      // Get the custom field.
      CustomField customField = customFieldService.getCustomField(customFieldId);

      // Get the drop-down custom field.
      DropDownCustomField dropDownCustomField =
          (DropDownCustomField) customFieldService.getCustomField(dropDownCustomFieldId);

      // Get the line item.
      LineItem lineItem = lineItemService.getLineItem(lineItemId);
View Full Code Here


        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (CustomField customField : page.getResults()) {
            if (customField instanceof DropDownCustomField) {
              List<String> dropDownCustomFieldStrings = new ArrayList<String>();
              DropDownCustomField dropDownCustomField = (DropDownCustomField) customField;
              if (dropDownCustomField.getOptions() != null) {
                for (CustomFieldOption customFieldOption : dropDownCustomField.getOptions()) {
                  dropDownCustomFieldStrings.add(customFieldOption.getDisplayName());
                }
              }
              System.out.println(i + ") Drop-down custom field with ID \"" + customField.getId()
                  + "\", name \"" + customField.getName() + "\", and options {"
View Full Code Here

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (CustomField customField : page.getResults()) {
            if (customField instanceof DropDownCustomField) {
              List<String> dropDownCustomFieldStrings = new ArrayList<String>();
              DropDownCustomField dropDownCustomField = (DropDownCustomField) customField;
              if (dropDownCustomField.getOptions() != null) {
                for (CustomFieldOption customFieldOption : dropDownCustomField.getOptions()) {
                  dropDownCustomFieldStrings.add(customFieldOption.getDisplayName());
                }
              }
              System.out.println(i + ") Drop-down custom field with ID \"" + customField.getId()
                  + "\", name \"" + customField.getName() + "\", and options {"
View Full Code Here

      // Get the custom field.
      CustomField customField = customFieldService.getCustomField(customFieldId);

      // Get the drop-down custom field.
      DropDownCustomField dropDownCustomField =
          (DropDownCustomField) customFieldService.getCustomField(dropDownCustomFieldId);

      // Get the line item.
      LineItem lineItem = lineItemService.getLineItem(lineItemId);
View Full Code Here

      // Set the ID of the activity to update.
      Integer activityId = Integer.parseInt("INSERT_ACTIVITY_ID_HERE");

      // Get the activity.
      Activity activity = activityService.getActivity(activityId);

      // Update the expected URL.
      activity.setExpectedURL("http://google.com");

      // Update the activity on the server.
      Activity[] activities = activityService.updateActivities(new Activity[] {activity});

      for (Activity updatedActivity : activities) {
View Full Code Here

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

      // Create a daily visits activity.
      Activity dailyVisitsActivity = new Activity();
      dailyVisitsActivity.setName("Activity #" + new Random().nextLong());
      dailyVisitsActivity.setActivityGroupId(activityGroupId);
      dailyVisitsActivity.setType(ActivityType.DAILY_VISITS);

      // Create a custom activity.
      Activity customActivity = new Activity();
      customActivity.setName("Activity #" + new Random().nextLong());
      customActivity.setActivityGroupId(activityGroupId);
      customActivity.setType(ActivityType.CUSTOM);

      // Create the activities on the server.
      Activity[] activities =
          activityService.createActivities(new Activity[] {dailyVisitsActivity, customActivity});
View Full Code Here

    // Get the ActivityGroupService.
    ActivityGroupServiceInterface activityGroupService =
        user.getService(DfpService.V201302.ACTIVITY_GROUP_SERVICE);

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

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

      // Get activity groups by statement.
      page = activityGroupService.getActivityGroupsByStatement(filterStatement);

      if (page.getResults() != null) {
        for (ActivityGroup activityGroup : page.getResults()) {
          activityGroupIds.add(activityGroup.getId());
        }
      }

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

    return activityGroupIds;
  }
View Full Code Here

  private static List<Integer> getAllActivityGroupIds(DfpUser user)
      throws RemoteException, ServiceException {
    List<Integer> activityGroupIds = new ArrayList<Integer>();

    // Get the ActivityGroupService.
    ActivityGroupServiceInterface activityGroupService =
        user.getService(DfpService.V201302.ACTIVITY_GROUP_SERVICE);

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

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

      // Get activity groups by statement.
      page = activityGroupService.getActivityGroupsByStatement(filterStatement);

      if (page.getResults() != null) {
        for (ActivityGroup activityGroup : page.getResults()) {
          activityGroupIds.add(activityGroup.getId());
        }
View Full Code Here

      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(
                  "%s) Activity with ID \"%d\", name \"%s\", and type \"%s\" was found.\n",
                  totalResultsCounter++, activity.getId(), activity.getName(), activity.getType());
            }
          }

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

      System.out.printf("Number of results found: %s\n", totalResultsCounter);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the ActivityService.
      ActivityServiceInterface activityService =
          user.getService(DfpService.V201302.ACTIVITY_SERVICE);

      // Set the ID of the activity to update.
      Integer activityId = Integer.parseInt("INSERT_ACTIVITY_ID_HERE");

      // Get the activity.
      Activity activity = activityService.getActivity(activityId);

      // Update the expected URL.
      activity.setExpectedURL("http://google.com");

      // Update the activity on the server.
      Activity[] activities = activityService.updateActivities(new Activity[] {activity});

      for (Activity updatedActivity : activities) {
        System.out.printf(
            "Activity with ID \"%d\" and name \"%s\" was updated.\n",
            updatedActivity.getId(), updatedActivity.getName());
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201302.DropDownCustomField

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.