Get the role/roles of a contributor
Paulino Alonso (38●12●15)
| asked Jul 19 '12, 9:25 a.m.
edited Jul 19 '12, 10:37 a.m. by David Olsen (523●7)
Hello,
I'm working with a follow up ... that extends AbstractService and implements IOperationParticipant To find the user who is logged: final IAuditableServer auditableServer = workItemServer.getAuditableServer();
IContributorHandle userHandle=this.
IContributor contributor= auditableServer. userHandle, ItemProfile.<IContributor> monitor); System.out.println("USER logeado: " + contributor.getName()); I need to know contributor roles and the projectArea or processArea in which this work... this post https://jazz.net/forum/ getContributorRoles(IContributorHandle contributor, IProcessArea processArea, IProgressMonitor monitor) ... but I need the processArea... Has anyone worked on something like that??? Thanks |
Accepted answer
Ralph Schoon (63.5k●3●36●46)
| answered Jul 19 '12, 11:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Jul 19 '12, 11:26 a.m.
I looked into my examples. Here some code. Please be aware it is client side code and you might need to use slightly different services. But I would assume you can do similar things in the server api. If you need the team repository, you can get to it from elements using .getOrigin(). I haven't tried to gt deeper into the process e.g. to find permissions etc.
private static void dumpContributor(ITeamRepository teamRepository, IProcessArea processArea, IContributorHandle handle) throws TeamRepositoryException { IContributor contributor = (IContributor) teamRepository.itemManager() .fetchCompleteItem(handle, IItemManager.DEFAULT, null); System.out.print(": " + contributor.getUserId() + "\t" + contributor.getName() + "\t" + contributor.getEmailAddress()+ "\t"); IProcessItemService processService = (IProcessItemService) teamRepository .getClientLibrary(IProcessItemService.class); IClientProcess process = processService.getClientProcess(processArea, null); IRole[] contributorRoles = process.getContributorRoles(contributor, processArea, null); for (int j = 0; j < contributorRoles.length; j++) { IRole role = (IRole) contributorRoles[j]; System.out.print(role.getId() + " "); } System.out.println(); } Ralph Schoon selected this answer as the correct answer
|
4 other answers
Ralph Schoon (63.5k●3●36●46)
| answered Jul 19 '12, 10:36 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
A process area can be a project area or a team area, I believe, if you look at the type hierarchy. I have passed project areas as well as team areas. Both work. You can have users and roles in both levels.
|
Ralph, thank you for your quick response!!
My problem is how to know the process or the project area... thanks! |
Ralph Schoon (63.5k●3●36●46)
| answered Jul 19 '12, 11:07 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Jul 19 '12, 11:10 a.m.
Ah, so I overlooked the most important part in your question.
You implement AbstractService so you can use this.getAuthenticatedContributor() to get it. If you are looking at other user data you can typically get to the project area e.g. using workItem.getProjectArea() and then you can iterate that for the team areas. Some code i was using to iterate that structure. ITeamAreaHierarchy teamhierarchy = projectArea .getTeamAreaHierarchySnapshot(); List teamAreas = projectArea.getTeamAreas(); for (Iterator iterator = teamAreas.iterator(); iterator.hasNext();) { ITeamAreaHandle handle = (ITeamAreaHandle) iterator.next(); ITeamArea teamArea = (ITeamArea) teamRepository.itemManager() .fetchCompleteItem(handle, IItemManager.DEFAULT, null); dumpContributors(teamRepository, teamArea); } I was thinking about your problem, but Ihaven't done an implementation myself. |
Thanks again
with your help and this post https://jazz.net/forum/questions/65852/advisor-plugin-using-iteamrepository i get it!! thanks |
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.