Examples of ManagedCustomerPage


Examples of com.google.api.ads.adwords.axis.v201306.mcm.ManagedCustomerPage

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[]{"Login", "CustomerId""Name"});

    // Get results.
    ManagedCustomerPage page = managedCustomerService.get(selector);

    // Display serviced account graph.
    if (page.getEntries() != null) {
      // Create map from customerId to customer node.
      Map<Long, ManagedCustomerTreeNode> customerIdToCustomerNode =
          new HashMap<Long, ManagedCustomerTreeNode>();

      // Create account tree nodes for each customer.
      for (ManagedCustomer customer : page.getEntries()) {
        ManagedCustomerTreeNode node = new ManagedCustomerTreeNode();
        node.account = customer;
        customerIdToCustomerNode.put(customer.getCustomerId(), node);
      }

      // For each link, connect nodes in tree.
      if (page.getLinks() != null) {
        for (ManagedCustomerLink link : page.getLinks()) {
          ManagedCustomerTreeNode managerNode = customerIdToCustomerNode.get(
              link.getManagerCustomerId());
          ManagedCustomerTreeNode childNode = customerIdToCustomerNode.get(
              link.getClientCustomerId());
          childNode.parentNode = managerNode;
          if (managerNode != null) {
            managerNode.childAccounts.add(childNode);
          }
        }
      }

      // Find the root account node in the tree.
      ManagedCustomerTreeNode rootNode = null;
      for (ManagedCustomer account : page.getEntries()) {
        if (customerIdToCustomerNode.get(account.getCustomerId()).parentNode == null) {
          rootNode = customerIdToCustomerNode.get(account.getCustomerId());
          break;
        }
      }
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201309.mcm.ManagedCustomerPage

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[]{"Login", "CustomerId""Name"});

    // Get results.
    ManagedCustomerPage page = managedCustomerService.get(selector);

    // Display serviced account graph.
    if (page.getEntries() != null) {
      // Create map from customerId to customer node.
      Map<Long, ManagedCustomerTreeNode> customerIdToCustomerNode =
          new HashMap<Long, ManagedCustomerTreeNode>();

      // Create account tree nodes for each customer.
      for (ManagedCustomer customer : page.getEntries()) {
        ManagedCustomerTreeNode node = new ManagedCustomerTreeNode();
        node.account = customer;
        customerIdToCustomerNode.put(customer.getCustomerId(), node);
      }

      // For each link, connect nodes in tree.
      if (page.getLinks() != null) {
        for (ManagedCustomerLink link : page.getLinks()) {
          ManagedCustomerTreeNode managerNode = customerIdToCustomerNode.get(
              link.getManagerCustomerId());
          ManagedCustomerTreeNode childNode = customerIdToCustomerNode.get(
              link.getClientCustomerId());
          childNode.parentNode = managerNode;
          if (managerNode != null) {
            managerNode.childAccounts.add(childNode);
          }
        }
      }

      // Find the root account node in the tree.
      ManagedCustomerTreeNode rootNode = null;
      for (ManagedCustomer account : page.getEntries()) {
        if (customerIdToCustomerNode.get(account.getCustomerId()).parentNode == null) {
          rootNode = customerIdToCustomerNode.get(account.getCustomerId());
          break;
        }
      }
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201402.mcm.ManagedCustomerPage

    Selector selector = new SelectorBuilder()
        .fields("Login", "CustomerId", "Name")
        .build();

    // Get results.
    ManagedCustomerPage page = managedCustomerService.get(selector);

    // Display serviced account graph.
    if (page.getEntries() != null) {
      // Create map from customerId to customer node.
      Map<Long, ManagedCustomerTreeNode> customerIdToCustomerNode =
          new HashMap<Long, ManagedCustomerTreeNode>();

      // Create account tree nodes for each customer.
      for (ManagedCustomer customer : page.getEntries()) {
        ManagedCustomerTreeNode node = new ManagedCustomerTreeNode();
        node.account = customer;
        customerIdToCustomerNode.put(customer.getCustomerId(), node);
      }

      // For each link, connect nodes in tree.
      if (page.getLinks() != null) {
        for (ManagedCustomerLink link : page.getLinks()) {
          ManagedCustomerTreeNode managerNode = customerIdToCustomerNode.get(
              link.getManagerCustomerId());
          ManagedCustomerTreeNode childNode = customerIdToCustomerNode.get(
              link.getClientCustomerId());
          childNode.parentNode = managerNode;
          if (managerNode != null) {
            managerNode.childAccounts.add(childNode);
          }
        }
      }

      // Find the root account node in the tree.
      ManagedCustomerTreeNode rootNode = null;
      for (ManagedCustomer account : page.getEntries()) {
        if (customerIdToCustomerNode.get(account.getCustomerId()).parentNode == null) {
          rootNode = customerIdToCustomerNode.get(account.getCustomerId());
          break;
        }
      }
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.mcm.ManagedCustomerPage

    Selector selector = new SelectorBuilder()
        .fields("Login", "CustomerId", "Name")
        .build();

    // Get results.
    ManagedCustomerPage page = managedCustomerService.get(selector);

    // Display serviced account graph.
    if (page.getEntries() != null) {
      // Create map from customerId to customer node.
      Map<Long, ManagedCustomerTreeNode> customerIdToCustomerNode =
          new HashMap<Long, ManagedCustomerTreeNode>();

      // Create account tree nodes for each customer.
      for (ManagedCustomer customer : page.getEntries()) {
        ManagedCustomerTreeNode node = new ManagedCustomerTreeNode();
        node.account = customer;
        customerIdToCustomerNode.put(customer.getCustomerId(), node);
      }

      // For each link, connect nodes in tree.
      if (page.getLinks() != null) {
        for (ManagedCustomerLink link : page.getLinks()) {
          ManagedCustomerTreeNode managerNode = customerIdToCustomerNode.get(
              link.getManagerCustomerId());
          ManagedCustomerTreeNode childNode = customerIdToCustomerNode.get(
              link.getClientCustomerId());
          childNode.parentNode = managerNode;
          if (managerNode != null) {
            managerNode.childAccounts.add(childNode);
          }
        }
      }

      // Find the root account node in the tree.
      ManagedCustomerTreeNode rootNode = null;
      for (ManagedCustomer account : page.getEntries()) {
        if (customerIdToCustomerNode.get(account.getCustomerId()).parentNode == null) {
          rootNode = customerIdToCustomerNode.get(account.getCustomerId());
          break;
        }
      }
View Full Code Here

Examples of com.google.api.ads.adwords.jaxws.v201406.mcm.ManagedCustomerPage

  @Before
  public void setUp() throws ApiException {
    managedCustomer = new ManagedCustomer();
    managedCustomer.setCustomerId(123L);
    managedCustomer.setCanManageClients(false);
    ManagedCustomerPage managedCustomerPage = new ManagedCustomerPage();
    managedCustomerPage.getEntries().add(managedCustomer);
    managedCustomerPage.setTotalNumEntries(1);

    MockitoAnnotations.initMocks(this);

    when(managedCustomerServiceInterfaceMock.get(
        Mockito.<Selector>anyObject())).thenReturn(managedCustomerPage);
View Full Code Here

Examples of com.google.api.ads.adwords.jaxws.v201406.mcm.ManagedCustomerPage

       {

    int startIndex = 0;
    Paging paging = new Paging();
    selector.setPaging(paging);
    ManagedCustomerPage managedCustomerPage;
    do {
      paging.setStartIndex(startIndex);
      paging.setNumberResults(NUMBER_OF_RESULTS);

      LOGGER.info("Retrieving next " + NUMBER_OF_RESULTS + " accounts.");

      try {
        managedCustomerPage = managedCustomerService.get(selector);
        accountList.addAll(managedCustomerPage.getEntries());
      } catch (ApiException e) {
        // Retry Once
        managedCustomerPage = managedCustomerService.get(selector);
        accountList.addAll(managedCustomerPage.getEntries());
      }

      LOGGER.info(accountList.size() + " accounts retrieved.");

      startIndex = startIndex + NUMBER_OF_RESULTS;
    } while (managedCustomerPage.getTotalNumEntries() > startIndex);
  }
View Full Code Here

Examples of com.google.api.adwords.v201306.mcm.ManagedCustomerPage

      // Create selector.
      Selector selector = new Selector();
      selector.setFields(new String[] {"Login", "CustomerId"});

      // Get results.
      ManagedCustomerPage page = managedCustomerService.get(selector);

      if (page.getEntries() != null) {
        // Create map from customerId to customer node.
        Map<Long, ManagedCustomerTreeNode> customerIdToCustomerNode =
            new HashMap<Long, ManagedCustomerTreeNode>();

        // Create account tree nodes for each customer.
        for (ManagedCustomer customer : page.getEntries()) {
          ManagedCustomerTreeNode node = new ManagedCustomerTreeNode();
          node.managedCustomer = customer;
          customerIdToCustomerNode.put(customer.getCustomerId(), node);
        }

        // For each link, connect nodes in tree.
        if (page.getLinks() != null) {
          for (ManagedCustomerLink link : page.getLinks()) {
            ManagedCustomerTreeNode managerNode = customerIdToCustomerNode.get(
                link.getManagerCustomerId());
            ManagedCustomerTreeNode childNode = customerIdToCustomerNode.get(
                link.getClientCustomerId());
            childNode.parentNode = managerNode;
            if (managerNode != null) {
              managerNode.childAccounts.add(childNode);
            }
          }
        }

        // Find the root account node in the tree.
        ManagedCustomerTreeNode rootNode = null;
        for (ManagedCustomer account : page.getEntries()) {
          if (customerIdToCustomerNode.get(account.getCustomerId()).parentNode == null) {
            rootNode = customerIdToCustomerNode.get(account.getCustomerId());
            break;
          }
        }
View Full Code Here

Examples of com.google.api.adwords.v201309.mcm.ManagedCustomerPage

      // Create selector.
      Selector selector = new Selector();
      selector.setFields(new String[] {"Login", "CustomerId"});

      // Get results.
      ManagedCustomerPage page = managedCustomerService.get(selector);

      if (page.getEntries() != null) {
        // Create map from customerId to customer node.
        Map<Long, ManagedCustomerTreeNode> customerIdToCustomerNode =
            new HashMap<Long, ManagedCustomerTreeNode>();

        // Create account tree nodes for each customer.
        for (ManagedCustomer customer : page.getEntries()) {
          ManagedCustomerTreeNode node = new ManagedCustomerTreeNode();
          node.managedCustomer = customer;
          customerIdToCustomerNode.put(customer.getCustomerId(), node);
        }

        // For each link, connect nodes in tree.
        if (page.getLinks() != null) {
          for (ManagedCustomerLink link : page.getLinks()) {
            ManagedCustomerTreeNode managerNode = customerIdToCustomerNode.get(
                link.getManagerCustomerId());
            ManagedCustomerTreeNode childNode = customerIdToCustomerNode.get(
                link.getClientCustomerId());
            childNode.parentNode = managerNode;
            if (managerNode != null) {
              managerNode.childAccounts.add(childNode);
            }
          }
        }

        // Find the root account node in the tree.
        ManagedCustomerTreeNode rootNode = null;
        for (ManagedCustomer account : page.getEntries()) {
          if (customerIdToCustomerNode.get(account.getCustomerId()).parentNode == null) {
            rootNode = customerIdToCustomerNode.get(account.getCustomerId());
            break;
          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.