当前位置: 首页>>代码示例>>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;未经允许,请勿转载。