// Get the TeamService.
TeamServiceInterface teamService =
dfpServices.get(session, TeamServiceInterface.class);
// Create a read/write team.
Team readWriteTeam = new Team();
readWriteTeam.setName("Read/write team #" + new Random().nextInt(Integer.MAX_VALUE));
readWriteTeam.setTeamAccessType(TeamAccessType.READ_WRITE);
readWriteTeam.setHasAllCompanies(false);
readWriteTeam.setHasAllInventory(false);
// Create a read-only team.
Team readOnlyTeam = new Team();
readOnlyTeam.setName("Read-only team #" + new Random().nextInt(Integer.MAX_VALUE));
readOnlyTeam.setTeamAccessType(TeamAccessType.READ_ONLY);
readOnlyTeam.setHasAllCompanies(false);
readOnlyTeam.setHasAllInventory(false);
// Create the teams on the server.
Team[] teams = teamService.createTeams(new Team[] {readWriteTeam, readOnlyTeam});
for (Team createdTeam : teams) {