int totalResultsCounter = 0;
for (Integer activityGroupId : activityGroupIds) {
// Set defaults for page.
ActivityPage page = new ActivityPage();
int offset = 0;
// Default for total result set size and offset.
int totalResultSetSize = 0;
// Set the activity group ID to select from.
statementBuilder.putValue("activityGroupId", activityGroupId);
do {
// Create a statement to get all activities from an activity group.
statementBuilder.setQuery(filterStatementString + offset);
// Get activities by statement.
page = activityService.getActivitiesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
for (Activity activity : page.getResults()) {
System.out.printf(
"%s) Activity with ID \"%d\", name \"%s\", and type \"%s\" was found.\n",
totalResultsCounter++, activity.getId(), activity.getName(), activity.getType());
}
}
offset += 500;
} while (offset < page.getTotalResultSetSize());
}
System.out.printf("Number of results found: %s\n", totalResultsCounter);
} catch (Exception e) {
e.printStackTrace();