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

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


      // Set the ID of the user to get.
      Long userId = Long.parseLong("INSERT_USER_ID_HERE");

      // Get the user.
      User usr = userService.getUser(userId);

      if (usr != null) {
        System.out.println("User with ID \"" + usr.getId()
            + "\" email \"" + usr.getEmail()
            + "\", and role \"" + usr.getRoleName() + "\" was found.");
      } else {
        System.out.println("No user found for this ID.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here


      // Get the UserService.
      UserServiceInterface userService = user.getService(DfpService.V201211.USER_SERVICE);

      // Get the current user.
      User usr = userService.getCurrentUser();

      System.out.println("User with ID \"" + usr.getId()
          + "\", email \"" + usr.getEmail()
          + "\", and role \"" + usr.getRoleName() + "\" is the current user.");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
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

      // 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

          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;
        }
View Full Code Here

          new StatementBuilder("WHERE id IN ( " + StringUtils.join(imageCreativeIds, ',')
              + ") and creativeType = :creativeType LIMIT 500").putValue("creativeType",
              ImageCreative.class.getSimpleName());

      // Retrieve all creatives which match.
      CreativePage page =
          creativeService.getCreativesByStatement(statementBuilder.toStatement());

      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);
View Full Code Here

      Statement filterStatement =
          new StatementBuilder("WHERE creativeType = :creativeType LIMIT 500")
              .putValue("creativeType", ImageCreative.class.getSimpleName()).toStatement();

      // Get creatives by statement.
      CreativePage page = creativeService.getCreativesByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (Creative creative : page.getResults()) {
          System.out.println(i + ") Creative with ID \"" + creative.getId()
              + "\", name \"" + creative.getName()
              + "\", and type \"" + creative.getCreativeType() + "\" was found.");
          i++;
        }
      }

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

      Statement filterStatement =
          new StatementBuilder("WHERE creativeType = :creativeType LIMIT 500")
              .putValue("creativeType", ImageCreative.class.getSimpleName()).toStatement();

      // Get creatives by statement.
      CreativePage page = creativeService.getCreativesByStatement(filterStatement);

      if (page.getResults() != null) {
        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;
View Full Code Here

      // Get the CreativeService.
      CreativeServiceInterface creativeService =
          user.getService(DfpService.V201302.CREATIVE_SERVICE);

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

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

        // Get creatives by statement.
        page = creativeService.getCreativesByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Creative creative : page.getResults()) {
            System.out.println(i + ") Creative with ID \"" + creative.getId()
                + "\", name \"" + creative.getName()
                + "\", and type \"" + creative.getCreativeType() + "\" was found.");
            i++;
          }
        }

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

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
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.