adWordsServices.get(session, VideoCampaignCriterionServiceInterface.class);
int offset = 0;
// Create selector.
VideoCampaignCriterionSelector selector = new VideoCampaignCriterionSelector();
selector.setCampaignIds(new long[] {campaignId});
// Select only from active campaigns.
selector.setCampaignStatuses(
new VideoCampaignStatus[] {VideoCampaignStatus.ENABLED});
selector.setPaging(new Paging(offset, PAGE_SIZE));
VideoCampaignCriterionPage page;
do {
// Get all criteria for the campaign.
page = videoCampaignCriterionService.get(selector);
// Display criteria.
if (page.getEntries() != null) {
for (VideoCampaignCriterion videoCampaignCriterion : page.getEntries()) {
String negative = (videoCampaignCriterion instanceof NegativeVideoCampaignCriterion)
? " (negative)"
: "";
System.out.printf("Video%s criterion ID '%d' of type '%s' was found.%n",
negative,
videoCampaignCriterion.getCriterion().getId(),
videoCampaignCriterion.getCriterion().getBaseCriterionType());
}
} else {
System.out.println("No criteria were found.");
}
offset += PAGE_SIZE;
selector.getPaging().setStartIndex(offset);
} while (offset < page.getTotalNumEntries());
}