adWordsServices.get(session, CampaignCriterionServiceInterface.class);
int offset = 0;
// Create selector.
Selector selector = new Selector();
selector.setFields(new String[] {"CampaignId", "Id", "CriteriaType", "PlatformName",
"LanguageName", "LocationName", "KeywordText"});
selector.setPredicates(new Predicate[] {new Predicate("CriteriaType", PredicateOperator.IN,
new String[] {"KEYWORD", "LANGUAGE", "LOCATION", "PLATFORM"})});
selector.setPaging(new Paging(offset, PAGE_SIZE));
CampaignCriterionPage page = null;
do {
page = campaignCriterionService.get(selector);
if (page.getEntries() != null) {
// Display campaigns.
for (CampaignCriterion campaignCriterion : page.getEntries()) {
System.out.printf("Campaign criterion with campaign id '%s', criterion id '%s', "
+ "and type '%s' was found.\n", campaignCriterion.getCampaignId(), campaignCriterion
.getCriterion().getId(), campaignCriterion.getCriterion().getCriterionType());
}
Thread.sleep(1000);
} else {
System.out.println("No campaign criteria were found.");
}
offset += PAGE_SIZE;
selector.getPaging().setStartIndex(offset);
} while (offset < page.getTotalNumEntries());
}