How to fetch role name using role ids using plain Java API?
Hi all,
I want to find out team area roles for the user and I used below code to for role ids:
teamArea.getRoleAssignmentIds(contributor);
but I want name of the role please give me API to fetch role name using its id.
Alternatively, I tried
IRole2[] contributorRoles = (IRole2[]) process.getContributorRoles(contributor, projectArea, null);
But it returns the roles of project area also. So it is not useful to me. I need only team area roles.
Please provide the right API
|
Accepted answer
Try this code snippet.
It used to work for me.
String URI = ....;
ITeamRepository teamRepository = TeamPlatform.getTeamRepositoryService().getTeamRepository(URI);
IProcessClient processClient = (IProcessClientService) teamRepository.getClientLibrary(IProcessClientService.class);
// IProcessArea can be a Project Area, or a Team Area
ITeamArea teamArea = ...;
IRole[] processAreaRoles = getProcessAreaRoles(teamArea );
IContributor contributor = ...;
IRole[] contributorRoles = teamArea .getRoleAssignments(contributor, processAreaRoles);
for (int i=0; i<contributorRoles.length; i++) {
IRole contributorRole = contributorRoles[i];
IRole2 contributorRole2 = (IRole2) contributorRole;
System.out.println(contributorRole2.getRoleName());
}
Andrew Ciaz selected this answer as the correct answer
|
One other answer
|
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.