本文整理汇总了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;
}
};
}
示例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;
}
示例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());
}
}
}
}
示例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;
}
示例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());
}
}
}
}