// Get the CreativeService.
CreativeServiceInterface creativeService =
user.getService(DfpService.V201211.CREATIVE_SERVICE);
// Set defaults for page and filterStatement.
CreativePage page = new CreativePage();
Statement filterStatement = new Statement();
int offset = 0;
do {
// Create a statement to get all creatives.
filterStatement.setQuery("LIMIT 500 OFFSET " + offset);
// Get creatives by statement.
page = creativeService.getCreativesByStatement(filterStatement);
if (page.getResults() != null) {
int i = page.getStartIndex();
for (Creative creative : page.getResults()) {
System.out.println(i + ") Creative with ID \"" + creative.getId()
+ "\", name \"" + creative.getName()
+ "\", and type \"" + creative.getCreativeType() + "\" was found.");
i++;
}
}
offset += 500;
} while (offset < page.getTotalResultSetSize());
System.out.println("Number of results found: " + page.getTotalResultSetSize());
} catch (Exception e) {
e.printStackTrace();
}
}