adWordsServices.get(session, VideoTargetingGroupServiceInterface.class);
int offset = 0;
// Create selector.
TargetingGroupSelector selector = new TargetingGroupSelector();
selector.setCampaignIds(new long[] {campaignId});
selector.setPaging(new Paging(offset, PAGE_SIZE));
TargetingGroupPage page;
do {
// Get all targeting groups for this account.
page = videoTargetingGroupService.get(selector);
// Display targeting groups.
if (page.getEntries() != null) {
for (TargetingGroup targetingGroup : page.getEntries()) {
System.out.printf("Targeting group id %d, campaign id '%d', "
+ "and name '%s' was found.%n",
targetingGroup.getId(),
targetingGroup.getCampaignId(),
targetingGroup.getName());
}
} else {
System.out.println("No targeting groups were found.");
}
offset += PAGE_SIZE;
selector.getPaging().setStartIndex(offset);
} while (offset < page.getTotalNumEntries());
}