Package com.google.api.ads.dfp.v201308

Examples of com.google.api.ads.dfp.v201308.User


      } else if (value instanceof Long) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof DateTime) {
        return new DateTimeValue(null, (DateTime) value);
      } else if (value instanceof Date) {
        return new DateValue(null, (Date) value);
      } else {
        throw new IllegalArgumentException("Unexpected Value type ["
            + value.getClass() + "]");
      }
    }
View Full Code Here


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

      // Get InventoryService.
      InventoryServiceInterface inventoryService =
          user.getService(DfpService.V201308.INVENTORY_SERVICE);

      // Create statement object to only select web ad unit sizes.
      Statement filterStatement = new StatementBuilder("WHERE targetPlatform = :targetPlatform")
          .putValue("targetPlatform", TargetPlatform.WEB.toString()).toStatement();

      // Get all ad unit sizes.
      AdUnitSize[] adUnitSizes = inventoryService.getAdUnitSizesByStatement(filterStatement);

      // Display results.
      if (adUnitSizes != null) {
        for (int i = 0; i < adUnitSizes.length; i++) {
          AdUnitSize adUnitSize = adUnitSizes[i];
View Full Code Here

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

      // Get the InventoryService.
      InventoryServiceInterface inventoryService =
          user.getService(DfpService.V201308.INVENTORY_SERVICE);

      // Set the ID of the ad unit to get.
      String adUnitId = "INSERT_AD_UNIT_ID_HERE";

      // Get the ad unit.
      AdUnit adUnit = inventoryService.getAdUnit(adUnitId);

      if (adUnit != null) {
        System.out.println("Ad unit with ID \"" + adUnit.getId()
            + "\", name \"" + adUnit.getName()
            + "\", and status \"" + adUnit.getStatus() + "\" was found.");
View Full Code Here

      throws ServiceException, RemoteException {
    // Create list to hold all ad units.
    List<AdUnit> adUnits = new ArrayList<AdUnit>();

    // Get InventoryService.
    InventoryServiceInterface inventoryService =
        user.getService(DfpService.V201308.INVENTORY_SERVICE);

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

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

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

      if (page.getResults() != null) {
        adUnits.addAll(Arrays.asList(page.getResults()));
      }
View Full Code Here

   * @throws RemoteException thrown if there was a problem retrieving ad units
   */
  private static AdUnit findRootAdUnit(DfpUser user)
      throws ServiceException, RemoteException {
    // Get InventoryService.
    InventoryServiceInterface inventoryService =
        user.getService(DfpService.V201308.INVENTORY_SERVICE);

    // 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];
    }

View Full Code Here

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

      // Get the InventoryService.
      InventoryServiceInterface inventoryService =
          user.getService(DfpService.V201308.INVENTORY_SERVICE);

      // Create a statement to get all ad units.
      Statement filterStatement = new Statement("LIMIT 500", null);

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

      if (page.getResults() != null) {
        // Update each local ad unit object by enabling AdSense.
        for (AdUnit adUnit : page.getResults()) {
          adUnit.getInheritedAdSenseSettings().getValue().setAdSenseEnabled(true);
        }

        // Update the ad units on the server.
        AdUnit[] updatedAdUnits = inventoryService.updateAdUnits(page.getResults());

        if (updatedAdUnits != null) {
          for (AdUnit adUnit : updatedAdUnits) {
            System.out.println("Ad unit with ID \"" + adUnit.getId() + "\", name \""
                + adUnit.getName() + "\", and is AdSense enabled \""
View Full Code Here

      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) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof DateTime) {
        return new DateTimeValue(null, (DateTime) value);
      } else if (value instanceof Date) {
        return new DateValue(null, (Date) value);
      } else {
View Full Code Here

   * @throws RemoteException if there was an error performing one of the SOAP
   *     calls
   * @throws InterruptedException if the thread was interrupted
   */
  public boolean waitForReportReady() throws RemoteException, InterruptedException {
    ReportJobStatus status = reportService.getReportJob(reportJobId).getReportJobStatus();
    while (status == ReportJobStatus.IN_PROGRESS) {
      Thread.sleep(SLEEP_TIMER);
      status = reportService.getReportJob(reportJobId).getReportJobStatus();
    }

View Full Code Here

   * @return the URL for the report download
   * @throws RemoteException if there was an error performing any Axis call
   * @throws IllegalStateException if the report is not ready to be downloaded
   */
  private String getDownloadUrl(ExportFormat exportFormat) throws RemoteException {
    ReportJobStatus status = reportService.getReportJob(reportJobId).getReportJobStatus();
    if (status != ReportJobStatus.COMPLETED) {
      throw new IllegalStateException("Report " + reportJobId
          + " must be completed before downloading. It is currently: " + status);
    }

View Full Code Here

      // Get InventoryService.
      InventoryServiceInterface inventoryService =
          user.getService(DfpService.V201308.INVENTORY_SERVICE);

      // Create statement object to only select web ad unit sizes.
      Statement filterStatement = new StatementBuilder("WHERE targetPlatform = :targetPlatform")
          .putValue("targetPlatform", TargetPlatform.WEB.toString()).toStatement();

      // Get all ad unit sizes.
      AdUnitSize[] adUnitSizes = inventoryService.getAdUnitSizesByStatement(filterStatement);
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201308.User

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.