當前位置: 首頁>>代碼示例>>Java>>正文


Java ManagedCustomerPage類代碼示例

本文整理匯總了Java中com.google.api.ads.adwords.jaxws.v201710.mcm.ManagedCustomerPage的典型用法代碼示例。如果您正苦於以下問題:Java ManagedCustomerPage類的具體用法?Java ManagedCustomerPage怎麽用?Java ManagedCustomerPage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ManagedCustomerPage類屬於com.google.api.ads.adwords.jaxws.v201710.mcm包,在下文中一共展示了ManagedCustomerPage類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUp

import com.google.api.ads.adwords.jaxws.v201710.mcm.ManagedCustomerPage; //導入依賴的package包/類
@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);
      
  managedCustomerDelegate = new ManagedCustomerDelegate(null, false) {
    @Override
    ManagedCustomerServiceInterface getManagedCustomerServiceInterface(
        AdWordsSession adWordsSession){
      return managedCustomerServiceInterfaceMock;
    }
  };
}
 
開發者ID:googleads,項目名稱:aw-reporting,代碼行數:24,代碼來源:ManagedCustomerServiceDelegateTest.java

示例2: getClientCustomerIds

import com.google.api.ads.adwords.jaxws.v201710.mcm.ManagedCustomerPage; //導入依賴的package包/類
/**
 * Gets all the client customer IDs for the {@link AdWordsSession}.
 *
 * <p>The accounts are read in complete, and after all accounts have been retrieved, their IDs
 * are extracted and returned in a {@code Set}.
 *
 * @return the {@link Set} with the IDs of the found accounts
 * @throws ApiException error from the API when retrieving the accounts
 */
public Set<Long> getClientCustomerIds() throws ApiException {
  Set<Long> clientCustomerIdsSet = new LinkedHashSet<Long>();
  ManagedCustomerPage managedCustomerPage;
  int offset = 0;

  SelectorBuilder builder = new SelectorBuilder();
  Selector selector =
      builder.fields(ManagedCustomerField.CustomerId)
          .offset(offset)
          .limit(NUMBER_OF_RESULTS)
          .equals(ManagedCustomerField.CanManageClients, String.valueOf(false))
          .build();

  do {
    LOGGER.info("Retrieving next {} accounts.", NUMBER_OF_RESULTS);

    try {
      managedCustomerPage = managedCustomerService.get(selector);
      addClientCustomerIds(managedCustomerPage, clientCustomerIdsSet);
    } catch (ApiException e) {
      // Retry once.
      managedCustomerPage = managedCustomerService.get(selector);
      addClientCustomerIds(managedCustomerPage, clientCustomerIdsSet);
    }

    LOGGER.info("{} accounts retrieved.", clientCustomerIdsSet.size());
    offset += NUMBER_OF_RESULTS;
    selector = builder.increaseOffsetBy(NUMBER_OF_RESULTS).build();
  } while (managedCustomerPage.getTotalNumEntries() > offset);

  return clientCustomerIdsSet;
}
 
開發者ID:googleads,項目名稱:adwords-alerting,代碼行數:42,代碼來源:ManagedCustomerDelegate.java

示例3: addClientCustomerIds

import com.google.api.ads.adwords.jaxws.v201710.mcm.ManagedCustomerPage; //導入依賴的package包/類
/**
 * Add client customer IDs into the result set.
 *
 * @param managedCustomerPage the page of managed customers
 * @param clientCustomerIdsSet the result set of client customer IDs
 */
private static void addClientCustomerIds(
    @Nullable ManagedCustomerPage managedCustomerPage, Set<Long> clientCustomerIdsSet) {
  if (managedCustomerPage != null) {
    List<ManagedCustomer> managedCustomers = managedCustomerPage.getEntries();
    
    // ManagedCustomerPage.getEntries() could return null.
    if (managedCustomers != null) {
      for (ManagedCustomer managedCustomer : managedCustomers) {
        clientCustomerIdsSet.add(managedCustomer.getCustomerId());
      }
    }
  }
}
 
開發者ID:googleads,項目名稱:adwords-alerting,代碼行數:20,代碼來源:ManagedCustomerDelegate.java

示例4: getClientCustomerIds

import com.google.api.ads.adwords.jaxws.v201710.mcm.ManagedCustomerPage; //導入依賴的package包/類
/**
 * Gets all the client customer IDs for the {@link AdWordsSession}.
 *
 * <p>The accounts are read in complete, and after all accounts have been retrieved, their IDs
 * are extracted and returned in a {@code Set}.
 *
 * @return the {@link Set} with the IDs of the found accounts
 * @throws ApiException error from the API when retrieving the accounts
 */
public Set<Long> getClientCustomerIds() throws ApiException {
  Set<Long> clientCustomerIdsSet = new LinkedHashSet<Long>();
  ManagedCustomerPage managedCustomerPage;
  int offset = 0;

  SelectorBuilder builder = new SelectorBuilder();
  Selector selector =
      builder.fields(ManagedCustomerField.CustomerId)
          .offset(offset)
          .limit(NUMBER_OF_RESULTS)
          .equals(ManagedCustomerField.CanManageClients, String.valueOf(false))
          .equals("ExcludeHiddenAccounts", String.valueOf(excludeHiddenAccounts))
          .build();

  do {
    LOGGER.info("Retrieving next {} accounts.", NUMBER_OF_RESULTS);

    managedCustomerPage = managedCustomerService.get(selector);
    addClientCustomerIds(managedCustomerPage, clientCustomerIdsSet);

    LOGGER.info("{} accounts retrieved.", clientCustomerIdsSet.size());
    offset += NUMBER_OF_RESULTS;
    selector = builder.increaseOffsetBy(NUMBER_OF_RESULTS).build();
  } while (managedCustomerPage.getTotalNumEntries() > offset);

  return clientCustomerIdsSet;
}
 
開發者ID:googleads,項目名稱:aw-reporting,代碼行數:37,代碼來源:ManagedCustomerDelegate.java

示例5: addClientCustomerIds

import com.google.api.ads.adwords.jaxws.v201710.mcm.ManagedCustomerPage; //導入依賴的package包/類
/**
 * Add client customer IDs into the result set.
 *
 * @param managedCustomerPage the page of managed customers
 * @param clientCustomerIdsSet the result set of client customer IDs
 */
private static void addClientCustomerIds(
    @Nullable ManagedCustomerPage managedCustomerPage, Set<Long> clientCustomerIdsSet) {
  if (managedCustomerPage != null) {
    List<ManagedCustomer> managedCustomers = managedCustomerPage.getEntries();

    // ManagedCustomerPage.getEntries() could return null.
    if (managedCustomers != null) {
      for (ManagedCustomer managedCustomer : managedCustomers) {
        clientCustomerIdsSet.add(managedCustomer.getCustomerId());
      }
    }
  }
}
 
開發者ID:googleads,項目名稱:aw-reporting,代碼行數:20,代碼來源:ManagedCustomerDelegate.java


注:本文中的com.google.api.ads.adwords.jaxws.v201710.mcm.ManagedCustomerPage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。