Package com.google.api.ads.adwords.jaxws.v201406.mcm

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


  private ManagedCustomerServiceInterface managedCustomerServiceInterfaceMock;
  private ManagedCustomerDelegate managedCustomerDelegate;

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


  @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

       {

    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

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

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

Related Classes of com.google.api.ads.adwords.jaxws.v201406.mcm.ManagedCustomerPage

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.