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

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


      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

    // Create a statement to only select the root ad unit.
    Statement filterStatement = new Statement("WHERE parentId IS NULL LIMIT 500", null);

    // Get ad units by statement.
    AdUnitPage page = inventoryService.getAdUnitsByStatement(filterStatement);

    if (page.getResults() != null) {
      return page.getResults()[0];
    }

    return null;
  }
View Full Code Here

      // Set the creative size.
      templateCreative.setSize(new Size(300, 250, false));

      // Create the asset variable value.
      AssetCreativeTemplateVariableValue assetVariableValue =
          new AssetCreativeTemplateVariableValue();
      assetVariableValue.setUniqueName("Imagefile");
      assetVariableValue.setAssetByteArray(MediaUtils.getAssetDataFromUrl(
          "http://www.google.com/intl/en/adwords/select/images/samples/inline.jpg"));
      // Filenames must be unique.
      assetVariableValue.setFileName(String.format("image%s.jpg", System.currentTimeMillis()));

      // Create the image width variable value.
      LongCreativeTemplateVariableValue imageWidthVariableValue =
          new LongCreativeTemplateVariableValue();
      imageWidthVariableValue.setUniqueName("Imagewidth");
View Full Code Here

      return (Value) value;
    } else if (value == null) {
      return new TextValue(null, null);
    } else {
      if (value instanceof Boolean) {
        return new BooleanValue(null, (Boolean) value);
      } else if (value instanceof Double) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof String) {
        return new TextValue(null, (String) value);
      } else if (value instanceof Long) {
View Full Code Here

      // Get the ContactService.
      ContactServiceInterface contactService =
          user.getService(DfpService.V201302.CONTACT_SERVICE);

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

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

        // Get contacts by statement.
        page = contactService.getContactsByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Contact contact : page.getResults()) {
            System.out.printf(
                "%s) Contact with ID \"%d\" and name \"%s\" was found.\n", i++,
                contact.getId(), contact.getName());
          }
        }

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

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

      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500")
              .putValue("status", ContactStatus.UNINVITED.toString()).toStatement();

      // Get contacts by statement.
      ContactPage page = contactService.getContactsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (Contact contact : page.getResults()) {
          System.out.printf(
              "%s) Contact with ID \"%d\" and name \"%s\" was found.\n", i++,
              contact.getId(), contact.getName());
        }
      }

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

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

      // Get the ContactService.
      ContactServiceInterface contactService =
          user.getService(DfpService.V201302.CONTACT_SERVICE);

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

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

        // Get contacts by statement.
        page = contactService.getContactsByStatement(filterStatement);

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

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

      // Get the ContactService.
      ContactServiceInterface contactService =
          user.getService(DfpService.V201302.CONTACT_SERVICE);

      // Create a statement to only select contacts that aren't invited yet.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500")
              .putValue("status", ContactStatus.UNINVITED.toString()).toStatement();

      // Get contacts by statement.
      ContactPage page = contactService.getContactsByStatement(filterStatement);

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

      // Set the ID of the creative to get.
      Long creativeId = Long.parseLong("INSERT_CREATIVE_ID_HERE");

      // Get the creative.
      Creative creative = creativeService.getCreative(creativeId);

      if (creative != null) {
        System.out.println("Creative with ID \"" + creative.getId()
             + "\", name \"" + creative.getName()
             + "\", and type \"" + creative.getCreativeType() + "\" was found.");
      } else {
        System.out.println("No creative found for this ID.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201302.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.