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

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


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

    // Get the ActivityGroupService.
    ActivityGroupServiceInterface activityGroupService =
        user.getService(DfpService.V201308.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


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

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

      // Set the ID of the activity group and the company to update it with.
      Integer activityGroupId = Integer.parseInt("INSERT_ACTIVITY_GROUP_ID_HERE");
      Long advertiserCompanyId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");

      // Get the activity group.
      ActivityGroup activityGroup = activityGroupService.getActivityGroup(activityGroupId);

      long[] companyIds = Arrays.copyOf(
          activityGroup.getCompanyIds(), activityGroup.getCompanyIds().length + 1);

      companyIds[companyIds.length - 1] = advertiserCompanyId;

      // Update the companies.
      activityGroup.setCompanyIds(companyIds);

      // Update the activity group on the server.
      ActivityGroup[] activityGroups =
          activityGroupService.updateActivityGroups(new ActivityGroup[] {activityGroup});

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

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

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

      // Create a statement to only select active activity groups.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500")
              .putValue("status", ActivityGroupStatus.ACTIVE.toString()).toStatement();

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

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (ActivityGroup activityGroup : page.getResults()) {
          System.out.printf(
View Full Code Here

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

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

      // Set the ID of the company for the activity group.
      Long advertiserCompanyId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");

      // Create a short-term activity group.
      ActivityGroup shortTermActivityGroup = new ActivityGroup();
      shortTermActivityGroup.setName("Short-term activity group #" + new Random().nextLong());
      shortTermActivityGroup.setCompanyIds(new long[] {advertiserCompanyId});
      shortTermActivityGroup.setClicksLookback(1);
      shortTermActivityGroup.setImpressionsLookback(1);

      // Create a long-term activity group.
      ActivityGroup longTermActivityGroup = new ActivityGroup();
      longTermActivityGroup.setName("Long-term activity group #" + new Random().nextLong());
      longTermActivityGroup.setCompanyIds(new long[] {advertiserCompanyId});
      longTermActivityGroup.setClicksLookback(30);
      longTermActivityGroup.setImpressionsLookback(30);

      // Create the activity groups on the server.
      ActivityGroup[] activityGroups = activityGroupService.createActivityGroups(
          new ActivityGroup[] {shortTermActivityGroup, longTermActivityGroup});

      for (ActivityGroup activityGroup : activityGroups) {
        System.out.printf("An activity group with ID \"%d\" and name \"%s\" was created.\n",
            activityGroup.getId(), activityGroup.getName());
View Full Code Here

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

      // Get the ActivityGroupService.
      ActivityGroupServiceInterface activityGroupService =
          user.getService(DfpService.V201308.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) {
          int i = page.getStartIndex();
          for (ActivityGroup activityGroup : page.getResults()) {
            System.out.printf(
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.V201311.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

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

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

      // Set the ID of the activity group and the company to update it with.
      Integer activityGroupId = Integer.parseInt("INSERT_ACTIVITY_GROUP_ID_HERE");
      Long advertiserCompanyId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");

      // Get the activity group.
      ActivityGroup activityGroup = activityGroupService.getActivityGroup(activityGroupId);

      long[] companyIds = Arrays.copyOf(
          activityGroup.getCompanyIds(), activityGroup.getCompanyIds().length + 1);

      companyIds[companyIds.length - 1] = advertiserCompanyId;

      // Update the companies.
      activityGroup.setCompanyIds(companyIds);

      // Update the activity group on the server.
      ActivityGroup[] activityGroups =
          activityGroupService.updateActivityGroups(new ActivityGroup[] {activityGroup});

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

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

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

      // Create a statement to only select active activity groups.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500")
              .putValue("status", ActivityGroupStatus.ACTIVE.toString()).toStatement();

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

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (ActivityGroup activityGroup : page.getResults()) {
          System.out.printf(
View Full Code Here

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

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

      // Set the ID of the company for the activity group.
      Long advertiserCompanyId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");

      // Create a short-term activity group.
      ActivityGroup shortTermActivityGroup = new ActivityGroup();
      shortTermActivityGroup.setName("Short-term activity group #" + new Random().nextLong());
      shortTermActivityGroup.setCompanyIds(new long[] {advertiserCompanyId});
      shortTermActivityGroup.setClicksLookback(1);
      shortTermActivityGroup.setImpressionsLookback(1);

      // Create a long-term activity group.
      ActivityGroup longTermActivityGroup = new ActivityGroup();
      longTermActivityGroup.setName("Long-term activity group #" + new Random().nextLong());
      longTermActivityGroup.setCompanyIds(new long[] {advertiserCompanyId});
      longTermActivityGroup.setClicksLookback(30);
      longTermActivityGroup.setImpressionsLookback(30);

      // Create the activity groups on the server.
      ActivityGroup[] activityGroups = activityGroupService.createActivityGroups(
          new ActivityGroup[] {shortTermActivityGroup, longTermActivityGroup});

      for (ActivityGroup activityGroup : activityGroups) {
        System.out.printf("An activity group with ID \"%d\" and name \"%s\" was created.\n",
            activityGroup.getId(), activityGroup.getName());
View Full Code Here

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

      // Get the ActivityGroupService.
      ActivityGroupServiceInterface activityGroupService =
          user.getService(DfpService.V201311.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) {
          int i = page.getStartIndex();
          for (ActivityGroup activityGroup : page.getResults()) {
            System.out.printf(
View Full Code Here

TOP

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

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.