It's all about the answers!

Ask a question

RTC Reportable API - Get list of teams' members for a project


Zachary K (19354339) | asked Mar 27 '14, 9:07 a.m.
edited Mar 28 '14, 11:47 a.m. by Stephanie Taylor (24115)
Hello,
Is there a way to get list of teams' members for a project using the RTC reportable APIs?

Thank you

2 answers



permanent link
K M (38325251) | answered Mar 27 '14, 9:45 a.m.
how about this
https://jazz:9443/jazz/rpt/repository/foundation?fields=foundation/teamArea/%28name|teamMembers/name|projectArea/name%29

permanent link
K M (38325251) | answered Mar 27 '14, 9:12 a.m.
    @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
Zachary K commented Mar 27 '14, 9:20 a.m. | edited Mar 27 '14, 12:49 p.m.

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?
Thanks

https://server:9443/ccm/rpt/repository/foundation?fields=foundation/projectArea/(name|teamMembers/name|modified|modifiedBy/name)&size=300&pos=0


Zachary K commented Mar 27 '14, 10:08 a.m.

Perfect thanks a lot - It works fine

Your answer


Register or to post 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.