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

Examples of com.google.api.ads.dfp.v201306.ActivityServiceInterface


  private static final String ACTIVITY_ID = "INSERT_ACTIVITY_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session,
      int activityId) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

    // 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


  private static final String ACTIVITY_GROUP_ID = "INSERT_ACTIVITY_GROUP_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session,
      int activityGroupId) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

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

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

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

    for (Activity createdActivity : activities) {
      System.out.printf("An activity with ID \"%d\", name \"%s\", and type \"%s\" was created.\n",
          createdActivity.getId(), createdActivity.getName(), createdActivity.getType());
    }
View Full Code Here

  private static final String ACTIVITY_GROUP_ID = "INSERT_ACTIVITY_GROUP_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session,
      int activityGroupId) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

    // Create a statement to only select active activities.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("activityGroupId = :activityGroupId and status = :status")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("activityGroupId", activityGroupId)
        .withBindVariableValue("status", ActivityStatus.ACTIVE.toString());

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

    do {
      // Get activities by statement.
      ActivityPage page = activityService.getActivitiesByStatement(statementBuilder.toStatement());

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

*/
public class GetAllActivities {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

    // Get all activity groups
    List<Integer> activityGroupIds = getAllActivityGroupIds(dfpServices, session);

    // Create a statement to get all activities for an activity group.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("activityGroupId = :activityGroupId")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

    int totalResultsCounter = 0;

    for (Integer activityGroupId : activityGroupIds) {
      // Set the activity group ID to select from.
      statementBuilder.withBindVariableValue("activityGroupId", activityGroupId);

      // Default for total result set size and offset.
      int totalResultSetSize = 0;
      statementBuilder.offset(0);

      do {
        // Get activities by statement.
        ActivityPage page =
            activityService.getActivitiesByStatement(statementBuilder.toStatement());

        if (page.getResults() != null) {
          totalResultSetSize = page.getTotalResultSetSize();
          for (Activity activity : page.getResults()) {
            System.out.printf(
View Full Code Here

  private static final String ACTIVITY_ID = "INSERT_ACTIVITY_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session,
      int activityId) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

    // 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

  private static final String ACTIVITY_GROUP_ID = "INSERT_ACTIVITY_GROUP_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session,
      int activityGroupId) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

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

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

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

    for (Activity createdActivity : activities) {
      System.out.printf("An activity with ID \"%d\", name \"%s\", and type \"%s\" was created.\n",
          createdActivity.getId(), createdActivity.getName(), createdActivity.getType());
    }
View Full Code Here

  private static final String ACTIVITY_GROUP_ID = "INSERT_ACTIVITY_GROUP_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session,
      int activityGroupId) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

    // Create a statement to only select active activities.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("activityGroupId = :activityGroupId and status = :status")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
        .withBindVariableValue("activityGroupId", activityGroupId)
        .withBindVariableValue("status", ActivityStatus.ACTIVE.toString());

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

    do {
      // Get activities by statement.
      ActivityPage page = activityService.getActivitiesByStatement(statementBuilder.toStatement());

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

*/
public class GetAllActivities {

  public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

    // Get all activity groups
    List<Integer> activityGroupIds = getAllActivityGroupIds(dfpServices, session);

    // Create a statement to get all activities for an activity group.
    StatementBuilder statementBuilder = new StatementBuilder()
        .where("activityGroupId = :activityGroupId")
        .orderBy("id ASC")
        .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);

    int totalResultsCounter = 0;

    for (Integer activityGroupId : activityGroupIds) {
      // Set the activity group ID to select from.
      statementBuilder.withBindVariableValue("activityGroupId", activityGroupId);

      // Default for total result set size and offset.
      int totalResultSetSize = 0;
      statementBuilder.offset(0);

      do {
        // Get activities by statement.
        ActivityPage page =
            activityService.getActivitiesByStatement(statementBuilder.toStatement());

        if (page.getResults() != null) {
          totalResultSetSize = page.getTotalResultSetSize();
          for (Activity activity : page.getResults()) {
            System.out.printf(
View Full Code Here

  private static final String ACTIVITY_ID = "INSERT_ACTIVITY_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session,
      int activityId) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

    // 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

  private static final String ACTIVITY_GROUP_ID = "INSERT_ACTIVITY_GROUP_ID_HERE";

  public static void runExample(DfpServices dfpServices, DfpSession session,
      int activityGroupId) throws Exception {
    // Get the ActivityService.
    ActivityServiceInterface activityService =
        dfpServices.get(session, ActivityServiceInterface.class);

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

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

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

    for (Activity createdActivity : activities) {
      System.out.printf("An activity with ID \"%d\", name \"%s\", and type \"%s\" was created.\n",
          createdActivity.getId(), createdActivity.getName(), createdActivity.getType());
    }
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201306.ActivityServiceInterface

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.