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

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


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

      // Get the LineItemService.
      LineItemServiceInterface lineItemService =
          user.getService(DfpService.V201302.LINEITEM_SERVICE);

      // Set the ID of the order to get line items from.
      Long orderId = Long.parseLong("INSERT_ORDER_ID_HERE");

      // Create a statement to get line items with even delivery rates.
      Statement filterStatement = new StatementBuilder(
          "WHERE deliveryRateType = :deliveryRateType AND orderId = :orderId LIMIT 500")
              .putValue("orderId", orderId)
              .putValue("deliveryRateType", DeliveryRateType.EVENLY.toString()).toStatement();

      // Get line items by statement.
      LineItemPage page = lineItemService.getLineItemsByStatement(filterStatement);

      if (page.getResults() != null) {
        LineItem[] lineItems = page.getResults();

        // Update each local line item object by changing its delivery rate.
        for (int i = 0; i < lineItems.length; i++) {
          // Archived line items cannot be updated.
          if (lineItems[i].getIsArchived()) {
            lineItems[i] = null;
          } else {
            lineItems[i].setDeliveryRateType(DeliveryRateType.AS_FAST_AS_POSSIBLE);
          }
        }

        // Update the line items on the server.
        lineItems = lineItemService.updateLineItems(lineItems);

        if (lineItems != null) {
          for (LineItem lineItem : lineItems) {
            System.out.println("A line item with ID \""
                + lineItem.getId() + "\", belonging to order ID \""
View Full Code Here


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

      // Get the LineItemService.
      LineItemServiceInterface lineItemService =
          user.getService(DfpService.V201302.LINEITEM_SERVICE);

      // Set the ID of the order to get line items from.
      Long orderId = Long.parseLong("INSERT_ORDER_ID_HERE");

      // Create a statement to only select line items that need creatives from a
      // given order.
      Statement filterStatement =
          new StatementBuilder("WHERE orderId = :orderId AND status = :status LIMIT 500")
              .putValue("orderId", orderId)
              .putValue("status", ComputedStatus.NEEDS_CREATIVES.toString())
              .toStatement();

      // Get line items by statement.
      LineItemPage page = lineItemService.getLineItemsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (LineItem lineItem : page.getResults()) {
          System.out.println(i + ") Line item with ID \""
View Full Code Here

          "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");
      imageWidthVariableValue.setValue(300L);

      // Create the image height variable value.
      LongCreativeTemplateVariableValue imageHeightVariableValue =
          new LongCreativeTemplateVariableValue();
      imageHeightVariableValue.setUniqueName("Imageheight");
      imageHeightVariableValue.setValue(250L);

      // Create the URL variable value.
      UrlCreativeTemplateVariableValue urlVariableValue =
          new UrlCreativeTemplateVariableValue();
      urlVariableValue.setUniqueName("ClickthroughURL");
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 {
        throw new IllegalArgumentException("Unexpected Value type ["
            + value.getClass() + "]");
View Full Code Here

      // Set the ID of the placement to get.
      Long placementId = Long.parseLong("INSERT_PLACEMENT_ID_HERE");

      // Get the placement.
      Placement placement = placementService.getPlacement(placementId);

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

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

      // Get the PlacementService.
      PlacementServiceInterface placementService =
          user.getService(DfpService.V201302.PLACEMENT_SERVICE);

      // Set the ID of the placement to get.
      Long placementId = Long.parseLong("INSERT_PLACEMENT_ID_HERE");

      // Get the placement.
      Placement placement = placementService.getPlacement(placementId);

      if (placement != null) {
        System.out.println("Placement with ID \"" + placement.getId()
            + "\", name \"" + placement.getName()
            + "\", and status \"" + placement.getStatus() + "\" was found.");
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

      customCreative.setHtmlSnippet("<a href='%%CLICK_URL_UNESC%%%%DEST_URL%%'>" +
          "<img src='%%FILE:" + customCreativeAsset.getMacroName() + "%%'/>" +
          "</a><br>Click above for great deals!");

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

      // Create the custom creative on the server.
      customCreative = (CustomCreative) creativeService.createCreative(customCreative);

      if (customCreative != null) {
View Full Code Here

      templateCreative.setName("Template creative");
      templateCreative.setAdvertiserId(advertiserId);
      templateCreative.setCreativeTemplateId(creativeTemplateId);

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

      // Create the asset variable value.
      AssetCreativeTemplateVariableValue assetVariableValue =
          new AssetCreativeTemplateVariableValue();
      assetVariableValue.setUniqueName("Imagefile");
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.