RTC Reportable API - Get list of teams' members for a project
2 answers
@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;
}
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;
}