adWordsServices.get(session, VideoTargetingGroupCriterionServiceInterface.class);
int offset = 0;
// Create selector.
TargetingGroupCriterionSelector selector = new TargetingGroupCriterionSelector();
selector.setTargetingGroupIds(new long[] {targetingGroupId});
selector.setCriteriaDimension(CriteriaDimension.KEYWORD);
selector.setPaging(new Paging(offset, PAGE_SIZE));
TargetingGroupCriterionPage page;
do {
// Get all criteria for the campaign.
page = videoTargetingGroupCriterionService.get(selector);
// Display criteria.
if (page.getEntries() != null) {
for (TargetingGroupCriterion targetingGroupCampaignCriterion : page.getEntries()) {
String negative =
(targetingGroupCampaignCriterion instanceof NegativeTargetingGroupCriterion)
? " (negative)"
: "";
System.out.printf("Video%s criterion id %d of type '%s' was found.%n",
negative,
targetingGroupCampaignCriterion.getCriterion().getId(),
targetingGroupCampaignCriterion.getCriterion().getBaseCriterionType());
}
} else {
System.out.println("No criteria were found.");
}
offset += PAGE_SIZE;
selector.getPaging().setStartIndex(offset);
} while (offset < page.getTotalNumEntries());
}