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


Java ManagedCustomerPage.getTotalNumEntries方法代碼示例

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


在下文中一共展示了ManagedCustomerPage.getTotalNumEntries方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例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))
          .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


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