// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get activities by statement.
ActivityPage page = activityService.getActivitiesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Activity activity : page.getResults()) {
System.out.printf(
"%d) Activity with ID \"%d\", name \"%s\", and type \"%s\" was found.\n", i++,
activity.getId(), activity.getName(), activity.getType());
}
}