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

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


   * @param date the DFP {@code Date} object to convert to a Java {@code Date}
   * @param timeZoneId the timezone of the date
   * @return the DFP {@code Date} object as a Java {@code Date} in the timezone
   */
  public static java.util.Date toDate(Date date, String timeZoneId) {
    return DateTimeUtils.toDate(new DateTime(date, 0, 0, 0, timeZoneId));
  }
View Full Code Here


   */
  public static DateTime fromDate(java.util.Date date) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);

    DateTime dfpDateTime = new DateTime();
    dfpDateTime.setDate(DateUtils.fromDate(date));
    dfpDateTime.setHour(calendar.get(Calendar.HOUR_OF_DAY));
    dfpDateTime.setMinute(calendar.get(Calendar.MINUTE));
    dfpDateTime.setSecond(calendar.get(Calendar.SECOND));

    return dfpDateTime;
  }
View Full Code Here

   * @param timeZoneId the timezone of the publisher
   * @return a {@code DateTime} object representing the present date in the
   *     publisher's timezone
   */
  public static DateTime today(String timeZoneId) {
    DateTime dateTime =
        fromDate(Calendar.getInstance(TimeZone.getTimeZone(timeZoneId)).getTime());
    dateTime.setHour(0);
    dateTime.setMinute(0);
    dateTime.setSecond(0);
    return dateTime;
  }
View Full Code Here

      } 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

      if (page.getResults() != null) {
        Creative[] creatives = page.getResults();
        long[] oldIds = new long[creatives.length];
        for (int i = 0; i < creatives.length; i++) {
          ImageCreative imageCreative = (ImageCreative) creatives[i];
          oldIds[i] = imageCreative.getId();
          imageCreative.setId(null);
          imageCreative.setAdvertiserId(imageCreative.getAdvertiserId());
          imageCreative.setName(
              imageCreative.getName() + " (Copy #" + System.currentTimeMillis() + ")");

          // Create image asset.
          CreativeAsset creativeAsset = new CreativeAsset();
          creativeAsset.setFileName("image.jpg");
          creativeAsset.setAssetByteArray(
              MediaUtils.getAssetDataFromUrl(imageCreative.getPrimaryImageAsset().getAssetUrl()));
          creativeAsset.setSize(imageCreative.getPrimaryImageAsset().getSize());
          imageCreative.setPrimaryImageAsset(creativeAsset);

          creatives[i] = imageCreative;
        }

        // Create the copied creative.
View Full Code Here

        Creative[] creatives = page.getResults();

        // Update each local creative object by changing its destination URL.
        for (Creative creative : creatives) {
          if (creative instanceof ImageCreative) {
            ImageCreative imageCreative = (ImageCreative) creative;
            imageCreative.setDestinationUrl("http://news.google.com");
          }
        }

        // Update the creatives on the server.
        creatives = creativeService.updateCreatives(creatives);

        if (creatives != null) {
          for (Creative creative : creatives) {
            if (creative instanceof ImageCreative) {
              ImageCreative imageCreative = (ImageCreative) creative;
              System.out.println("An image creative with ID \"" + imageCreative.getId()
                  + "\" and destination URL \"" + imageCreative.getDestinationUrl()
                  + "\" was updated.");
            }
          }
        } else {
          System.out.println("No creatives updated.");
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

   * @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

TOP

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