*/
public class GetImageCreatives {
public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
// Get the CreativeService.
CreativeServiceInterface creativeService =
dfpServices.get(session, CreativeServiceInterface.class);
// Create a statement to only select image creatives.
StatementBuilder statementBuilder = new StatementBuilder()
.where("creativeType = :creativeType")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("creativeType", ImageCreative.class.getSimpleName());
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get creatives by statement.
CreativePage page = creativeService.getCreativesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Creative creative : page.getResults()) {