Package com.google.api.ads.dfp.axis.v201208

Examples of com.google.api.ads.dfp.axis.v201208.CompanyServiceInterface


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

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201302.COMPANY_SERVICE);

      // Create a statement to only select companies that are advertisers.
      Statement filterStatement =
          new StatementBuilder("WHERE type = :type LIMIT 500")
              .putValue("type", CompanyType.ADVERTISER.toString()).toStatement();

      // Get the companies by statement.
      CompanyPage page =
          companyService.getCompaniesByStatement(filterStatement);

      if (page.getResults() != null) {
        Company[] companies = page.getResults();

        // Update each local company object by appending LLC. to its name.
        for (Company company : companies) {
          company.setName(company.getName() + " LLC.");
        }

        // Update the companies on the server.
        companies = companyService.updateCompanies(companies);

        if (companies != null) {
          for (Company company : companies) {
            System.out.println("A company with ID \"" + company.getId()
                + "\" and name \"" + company.getName() + "\" was updated.");
View Full Code Here


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

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201306.COMPANY_SERVICE);

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

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

        // Get companies by statement.
        page = companyService.getCompaniesByStatement(filterStatement);

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

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

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201306.COMPANY_SERVICE);

      // Set the ID of the company to get.
      Long companyId = Long.parseLong("INSERT_COMPANY_ID_HERE");

      // Get the company.
      Company company = companyService.getCompany(companyId);

      if (company != null) {
        System.out.println("Company with ID \"" + company.getId()
            + "\", name \"" + company.getName()
            + "\", and type \"" + company.getType() + "\" was found.");
View Full Code Here

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

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201306.COMPANY_SERVICE);

      // Create an array to store local company objects.
      Company[] companies = new Company[5];

      for (int i = 0; i < 5; i++) {
        Company company = new Company();
        company.setName("Advertiser #" + i);
        company.setType(CompanyType.ADVERTISER);
        companies[i] = company;
      }

      // Create the companies on the server.
      companies = companyService.createCompanies(companies);

      if (companies != null) {
        for (Company company : companies) {
          System.out.println("A company with ID \"" + company.getId()
              + "\", name \"" + company.getName()
View Full Code Here

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

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201306.COMPANY_SERVICE);

      // Create a statement to only select companies that are advertisers sorted
      // by name.
      Statement filterStatement =
          new StatementBuilder("WHERE type = :type ORDER BY name LIMIT 500")
              .putValue("type", CompanyType.ADVERTISER.toString()).toStatement();

      // Get companies by statement.
      CompanyPage page = companyService.getCompaniesByStatement(filterStatement);

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

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

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201306.COMPANY_SERVICE);

      // Create a statement to only select companies that are advertisers.
      Statement filterStatement =
          new StatementBuilder("WHERE type = :type LIMIT 500")
              .putValue("type", CompanyType.ADVERTISER.toString()).toStatement();

      // Get the companies by statement.
      CompanyPage page =
          companyService.getCompaniesByStatement(filterStatement);

      if (page.getResults() != null) {
        Company[] companies = page.getResults();

        // Update each local company object by appending LLC. to its name.
        for (Company company : companies) {
          company.setName(company.getName() + " LLC.");
        }

        // Update the companies on the server.
        companies = companyService.updateCompanies(companies);

        if (companies != null) {
          for (Company company : companies) {
            System.out.println("A company with ID \"" + company.getId()
                + "\" and name \"" + company.getName() + "\" was updated.");
View Full Code Here

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

    // Get the CompanyService.
    CompanyServiceInterface companyService =
        user.getService(DfpService.V201306.COMPANY_SERVICE);

    // Get companies by filter.
    CompanyPage page = companyService.getCompaniesByStatement(new Statement("LIMIT 1", null));
  }
View Full Code Here

  public static void main(String[] args) throws Exception {
    // Get DfpUser from "~/dfp.properties".
    DfpUser user = new DfpUser();

    // Get the CompanyService.
    CompanyServiceInterface companyService =
        user.getService(DfpService.V201306.COMPANY_SERVICE);

    // Initialize the root logger so that all messages do not filter up.
    DfpServiceLogger.initRootLogger();

    // Log the incoming and outgoing XML to System.out;
    DfpServiceLogger.logToStream(DfpServiceLogger.SOAP_XML_LOG, System.out);

    // Fake an exception to test logger which will not work yet.
    DfpServiceLogger.DFP_API_LIB_LOG.error("Error in the library.",
        new NullPointerException());

    // Log errors of the DFP library to System.err.
    DfpServiceLogger.logToStream(DfpServiceLogger.DFP_API_LIB_LOG, System.err, Level.ERROR);

    // Fake an exception to test logger which will work now.
    DfpServiceLogger.DFP_API_LIB_LOG.error("Error in the library.", new NullPointerException());

    // Get companies by filter.
    CompanyPage page = companyService.getCompaniesByStatement(new Statement("LIMIT 1", null));

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

    // Create the service accountant manager to automatically create
    // service accountants on first call and to not retain services.
    ServiceAccountantManager serviceAccountantManager = ServiceAccountantManager.getInstance();

    // Get the CompanyService.
    CompanyServiceInterface companyService = user.getService(DfpService.V201306.COMPANY_SERVICE);

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

    // Get the InventoryService.
View Full Code Here

   *     request
   */
  private static void makeApiRequest(DfpUser user) throws ServiceException, RemoteException,
      ApiException {
    // Service will use the auth token which was set by user.setAuthToken().
    CompanyServiceInterface companyService =
        user.getService(DfpService.V201306.COMPANY_SERVICE);
    companyService.getCompaniesByStatement(new Statement("LIMIT 1", null));
    System.out.println("Service call was successful.");
  }
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.axis.v201208.CompanyServiceInterface

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.