Package com.google.api.adwords.v201309.mcm

Examples of com.google.api.adwords.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


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

    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

    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

  @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

          user.getService(AdWordsService.V201309.ADGROUP_SERVICE);

      long adGroupId = Long.parseLong("INSERT_AD_GROUP_ID_HERE");

      // Create ad group with DELETED status.
      AdGroup adGroup = new AdGroup();
      adGroup.setId(adGroupId);
      adGroup.setStatus(AdGroupStatus.DELETED);

      // Create operations.
      AdGroupOperation operation = new AdGroupOperation();
      operation.setOperand(adGroup);
      operation.setOperator(Operator.SET);
View Full Code Here

          user.getService(AdWordsService.V201309.ADGROUP_SERVICE);

      long adGroupId = Long.parseLong("INSERT_AD_GROUP_ID_HERE");

      // Create ad group with updated status.
      AdGroup adGroup = new AdGroup();
      adGroup.setId(adGroupId);
      adGroup.setStatus(AdGroupStatus.PAUSED);

      // Create operations.
      AdGroupOperation operation = new AdGroupOperation();
      operation.setOperand(adGroup);
      operation.setOperator(Operator.SET);
View Full Code Here

      }

      Long experimentId = result.getValue()[0].getId();

      // Set ad group for the experiment.
      AdGroup adGroup = new AdGroup();
      adGroup.setId(adGroupId);

      // Create experiment bid multiplier rule that will modify ad group bid for
      // the experiment.
      ManualCPCAdGroupExperimentBidMultipliers adGroupExperimentBidMultipliers =
          new ManualCPCAdGroupExperimentBidMultipliers();
      adGroupExperimentBidMultipliers.setMaxCpcMultiplier(new BidMultiplier(1.5, null));

      // Set experiment data to the ad group.
      AdGroupExperimentData adGroupExperimentData = new AdGroupExperimentData();
      adGroupExperimentData.setExperimentId(experimentId);
      adGroupExperimentData.setExperimentDeltaStatus(ExperimentDeltaStatus.MODIFIED);
      adGroupExperimentData.setExperimentBidMultipliers(adGroupExperimentBidMultipliers);
      adGroup.setExperimentData(adGroupExperimentData);

      // Create operation.
      AdGroupOperation adGroupOperation = new AdGroupOperation();
      adGroupOperation.setOperand(adGroup);
      adGroupOperation.setOperator(Operator.SET);

      // Update ad group.
      adGroup = adGroupService.mutate(new AdGroupOperation[]{adGroupOperation}).getValue()[0];

      System.out.println("Ad group with name \"" + adGroup.getName() + "\" and id \""
          + adGroup.getId() + "\" was updated for the experiment.");

      // Set ad group criterion for the experiment.
      BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();
      adGroupCriterion.setCriterion(new Criterion(criterionId, null, null));
      adGroupCriterion.setAdGroupId(adGroupId);
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201309.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.