public class GetActiveCreativeWrappers {
public static void runExample(DfpServices dfpServices, DfpSession session)
throws Exception {
// Get the CreativeWrapperService.
CreativeWrapperServiceInterface creativeWrapperService =
dfpServices.get(session, CreativeWrapperServiceInterface.class);
// Create a statement to only select the active creative wrappers.
StatementBuilder statementBuilder = new StatementBuilder()
.where("WHERE status = :status")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", CreativeWrapperStatus.ACTIVE.toString());
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get creative wrappers by statement.
CreativeWrapperPage page =
creativeWrapperService.getCreativeWrappersByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (CreativeWrapper creativeWrapper : page.getResults()) {