// Get the CreativeSetService.
CreativeSetServiceInterface creativeSetService =
user.getService(DfpService.V201311.CREATIVE_SET_SERVICE);
// Set defaults for page and filterStatement.
CreativeSetPage page = new CreativeSetPage();
Statement filterStatement = new Statement();
int offset = 0;
do {
// Create a statement to get all creative sets.
filterStatement.setQuery("LIMIT 500 OFFSET " + offset);
// Get creative sets by statement.
page = creativeSetService.getCreativeSetsByStatement(filterStatement);
if (page.getResults() != null) {
int i = page.getStartIndex();
for (CreativeSet creativeSet : page.getResults()) {
System.out.println(i + ") Creative set with ID \"" + creativeSet.getId()
+ "\", master creative ID \"" + creativeSet.getMasterCreativeId()
+ "\", and companion creative IDs {"
+ StringUtils.join(ArrayUtils.toObject(creativeSet.getCompanionCreativeIds()), ',')
+ "} was found.");
i++;
}
}
offset += 500;
} while (offset < page.getTotalResultSetSize());
System.out.println("Number of results found: " + page.getTotalResultSetSize());
} catch (Exception e) {
e.printStackTrace();
}
}