RTC Reportable API - Get list of teams' members for a project
Zachary K (193●5●43●39)
| asked Mar 27 '14, 9:07 a.m.
edited Mar 28 '14, 11:47 a.m. by Stephanie Taylor (241●1●5)
Hello,
Is there a way to get list of teams' members for a project using the RTC reportable APIs? Thank you |
2 answers
how about this
https://jazz:9443/jazz/rpt/repository/foundation?fields=foundation/teamArea/%28name|teamMembers/name|projectArea/name%29 |
@SuppressWarnings("unchecked")
public List<ITeamArea> getProjectTeamsByName(String name) throws TeamRepositoryException { IProjectArea project = getProjectByName(name); if(project != null){ List<ITeamAreaHandle> teamHandles = project.getTeamAreas(); List<ITeamArea> teams = new ArrayList<ITeamArea>(); for(ITeamAreaHandle handle : teamHandles) teams.add((ITeamArea)repo.itemManager().fetchCompleteItem((ITeamAreaHandle)handle, IItemManager.DEFAULT, MONITOR)); return teams; } return null; } public String getProjectsRoleListName(String projectName) throws TeamRepositoryException{ String list = ""; IProjectArea project = getProjectByName(projectName); if(project == null) throw new TeamRepositoryException("Could not find project " + projectName); IContributorHandle[] members = project.getMembers(); IProcessItemService service = (IProcessItemService)repo.getClientLibrary(IProcessItemService.class); IClientProcess client_service = service.getClientProcess(project,MONITOR); IRole[] availableRoles = client_service.getRoles(project,MONITOR); String roles = "\t\t"; for (int k = 0; k < availableRoles.length; k++) { if(k != 0) roles += ","; roles += availableRoles[k].getId(); // + " - " + availableRoles[k].getDescription(); } list += "\tAvailiable Roles - " + roles +"\n\n"; for(int i = 0; i < members.length; i ++){ IContributor member = (IContributor)repo.itemManager().fetchCompleteItem(members[i], IItemManager.DEFAULT, MONITOR); IRole[] memberRoles = client_service.getContributorRoles(member,project,MONITOR); roles = "\t\t"; for (int k = 0; k < memberRoles.length; k++) { if(k != 0) roles += ","; roles += memberRoles[k].getId(); // + " - " + availableRoles[k].getDescription(); } list += "\n\t"+ member.getUserId() + "\n" + roles; } return list; } Comments Thanks but I'm looking for REST reportable API. For instance to get the project's members I can use the following but how can I use a similar query to get the list of teams with their members for a given project?
Zachary K
commented Mar 27 '14, 10:08 a.m.
Perfect thanks a lot - It works fine
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.