VideoCampaignSelector selector = new VideoCampaignSelector();
selector.setStatsSelector(statsSelector);
selector.setIds(new long[] {campaignId});
selector.setPaging(new Paging(offset, PAGE_SIZE));
VideoCampaignPage page;
do {
// Get all campaigns.
page = videoCampaignService.get(selector);
// Display campaigns.
if (page.getEntries() != null) {
for (VideoCampaign videoCampaign : page.getEntries()) {
System.out.printf("Campaign id %d, name '%s' and status '%s'%n",
videoCampaign.getId(),
videoCampaign.getName(),
videoCampaign.getStatus());
if (videoCampaign.getStats() != null) {
System.out.println("\tCampaign stats:");
System.out.println("\t\t" + format(videoCampaign.getStats()));
}
if (videoCampaign.getSegmentedStats() != null) {
for (VideoEntityStats segment : videoCampaign.getSegmentedStats()) {
System.out.println("\tCampaign segmented stats for month of "
+ segment.getSegmentKey().getDateKey().getDate());
System.out.println("\t\t" + format(segment));
}
}
}
if (page.getSummaryStats() != null) {
for (VideoEntityStats summary : page.getSummaryStats()) {
System.out.println("\tSummary of type "
+ summary.getSummaryType());
System.out.println("\t\t" + format(summary));
}
}
} else {
System.out.println("No matching campaigns were found.");
}
offset += PAGE_SIZE;
selector.getPaging().setStartIndex(offset);
} while (offset < page.getTotalNumEntries());
}