// Get the custom targeting value ID for the comedy category.
long categoryCustomTargetingValueId = customTargetingValuePage.getResults()[0].getId();
// Set defaults for page and filterStatement.
ContentPage page = new ContentPage();
Statement filterStatement = new Statement();
int offset = 0;
do {
// Create a statement to get all active content.
filterStatement.setQuery("WHERE status = 'ACTIVE' LIMIT 500 OFFSET " + offset);
// Get content by statement.
page = contentService.getContentByStatementAndCustomTargetingValue(filterStatement,
categoryCustomTargetingValueId);
if (page.getResults() != null) {
int i = page.getStartIndex();
for (Content content : page.getResults()) {
System.out.println(i + ") Content with ID \"" + content.getId()
+ "\", name \"" + content.getName()
+ "\", and status \"" + content.getStatus() + "\" was found.");
i++;
}
}
offset += 500;
} while (offset < page.getTotalResultSetSize());
System.out.println("Number of results found: " + page.getTotalResultSetSize());
} catch (Exception e) {
e.printStackTrace();
}
}