UserTeamAssociation[] userTeamAssociations = new UserTeamAssociation[userIds.length];
// For each user, associate it with the given team.
int i = 0;
for (Long userId : userIds) {
UserTeamAssociation userTeamAssociation = new UserTeamAssociation();
userTeamAssociation.setUserId(userId);
userTeamAssociation.setTeamId(teamId);
userTeamAssociations[i++] = userTeamAssociation;
}
// Create the user team associations on the server.
userTeamAssociations =
userTeamAssociationService.createUserTeamAssociations(userTeamAssociations);
if (userTeamAssociations != null) {
for (UserTeamAssociation userTeamAssociation : userTeamAssociations) {
System.out.println("A user team association between user with ID \""
+ userTeamAssociation.getUserId() + "\" and team with ID \""
+ userTeamAssociation.getTeamId() + "\" was created.");
}
} else {
System.out.println("No user team associations created.");
}
} catch (Exception e) {