*/
public class GetActiveActivityGroups {
public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
// Get the ActivityGroupService.
ActivityGroupServiceInterface activityGroupService =
dfpServices.get(session, ActivityGroupServiceInterface.class);
// Create a statement to only select active activity groups.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", ActivityGroupStatus.ACTIVE.toString());
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get activity groups by statement.
ActivityGroupPage page =
activityGroupService.getActivityGroupsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (ActivityGroup activityGroup : page.getResults()) {