Since
1UserLocalServiceUtil.getTeamUsers()
is not yet implemented (I'm using Liferay 6.1.1 CE GA2) I had to find another way to get users associated with teams.
Looking at portal/portal-web/docroot/html/portlet/sites_admin/edit_team_assignments_user.jsp, I managed to get a list of users with the following snippet:
1LinkedHashMap<String, Object> userParams = new LinkedHashMap<String, Object>();
2userParams.put("usersTeams", teamId);
3
4List<User> teamUsers = UserLocalServiceUtil.search(companyId,
5 null, WorkFlowConstants.STATUS_ANY, userParams,
6 QueryUtil.ALL_POS, QueryUtil.ALL_POS, (OrderByComparator) null);
May not be the best way to do it but does not require servicebuilder or custom queries.
The Liferay docs suggest that, for performance reasons, it would be better to use the indexed version of
UserLocalServiceUtil.search() but I haven't seen any examples of that version being used. If anyone has info about the indexed version, please share.
Anyway, hopefully someone will have use for this workaround while we wait for
UserLocalServiceUtil.getTeamUsers() to be implemented.
Regards
Thomas