[SOLVED] Get users with a role on a Teamarea
Hi,
I'm developing a plugin that needs to get a list of all the members from a teamArea that have a determinated role ( p.e. ScrumMaster ). I've been able to get the IContributor list from the TeamArea, but I can't figure how to get the roles from that team area and match the data or if there is any 'magic' method to get the relation between user/role in a teamArea. Any idea? Thanks! |
4 answers
Hi, Try below sample code: IServerProcess serverProcess = getProcessService().getServerProcess(fProjectArea); 1. get all roles: IRole[] roles = serverProcess.getRoles(fProjectArea); 2. getting contributor role: IRole[] contributorRoles = serverProcess.getContributorRoles(contributor, fProjectArea); |
Thanks for replying,
I've been trying the second option: getting contributor role: I did: import com.ibm.team.process.service.IServerProcess; I also registered the service 'com.ibm.team.process.service.IServerProcess' in the plugin.xml as a prerequisite. <extension> And iside the prerequiste tag interface="com.ibm.team.process.service.IServerProcess" The problem I get is that when I execute the advisor I get the following error: CRJAZ1115I The service "com.ibm.team.process.service.IServerProcess" is not registered, any idea why this is happening? Thanks! |
Hello Pere,
As per IServerProcess documentation: "A server process is a proxy for the server-side team process for a given project area. Server processes can not be persisted or be returned by a service method" So try following code to get the Server Process from the governing Process Area service: IProcessServerService processService = getService(IProcessServerService.class); IServerProcess serverProcess = processService.getServerProcess(processArea); And the required service you depend on is then "IProcessServerService". Regards, Jorge. |
Hi Jorge,
It worked ! To sum up a bit this thread I post the 'key' code to work with the roles of a team area in a plugin. IProcessServerService processService = getService(IProcessServerService.class); And add on the plugin.xml the prerequisite com.ibm.team.repository.service.IRepositoryItemService Thank u all for the help! Comments
Nate Decker
commented Jul 16 '14, 1:38 p.m.
I'm trying to do something similar to this and am having difficulties following the example outlined in this thread. Can you elaborate on what you needed to do to get this working? Why did you include a mention of IRepositoryItemService in the plugin.xml? Did you also include the IServerProcess as a prerequisite as well as you seemed to indicate in your previous post? Did you need to import the class as you had indicated in your previous post or was the prerequisite all that was needed? 1
sam detweiler
commented Jul 16 '14, 1:53 p.m.
when you create your plugin, open the plugin.xml and on the Extensions tab,
Nate Decker
commented Jul 16 '14, 2:29 p.m.
Thanks for the clarification. I think I finally realized what was going on here. I should have read your earlier post more carefully. I had assumed you could instantiate an instance of IServerProcess by saying something like: IServerProcess sp = getService(IServierProcess.class); I see now though that you have to go through the IProcessServerService. I think that was my issue. I'll give that a try. |
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.