// Get the TeamService.
TeamServiceInterface teamService = user.getService(DfpService.V201302.TEAM_SERVICE);
// Set defaults for page and filterStatement.
TeamPage page = new TeamPage();
Statement filterStatement = new Statement();
int offset = 0;
do {
// Create a statement to get all teams.
filterStatement.setQuery("LIMIT 500 OFFSET " + offset);
// Get teams by statement.
page = teamService.getTeamsByStatement(filterStatement);
if (page.getResults() != null) {
int i = page.getStartIndex();
for (Team team : page.getResults()) {
System.out.println(i + ") Team with ID \"" + team.getId()
+ "\", name \"" + team.getName() + "\" was found.");
i++;
}
}
offset += 500;
} while (offset < page.getTotalResultSetSize());
System.out.println("Number of results found: " + page.getTotalResultSetSize());
} catch (Exception e) {
e.printStackTrace();
}
}