It's all about the answers!

Ask a question

[SOLVED] Get users with a role on a Teamarea


0
1
pere irazusta (2062120) | asked Oct 27 '11, 1:04 p.m.
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



permanent link
pere irazusta (2062120) | answered Oct 31 '11, 6:50 a.m.
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);

IProcessArea processArea = operation.getProcessArea();
IServerProcess serverProcess = processService.getServerProcess(processArea);
IRole [] memberRoles = serverProcess.getContributorRoles(memberHandle, processArea);


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,
expand your extension definition, by right clicking to keep adding elements thru the Prerequisites.



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.


permanent link
Jorge Diaz (8664434) | answered Oct 28 '11, 4:50 p.m.
JAZZ DEVELOPER
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.

permanent link
pere irazusta (2062120) | answered Oct 28 '11, 12:50 p.m.
Thanks for replying,

I've been trying the second option:

getting contributor role:
IRole[] contributorRoles = serverProcess.getContributorRoles(contributor, fProjectArea);


I did:
import com.ibm.team.process.service.IServerProcess;

IServerProcess serverProcess = getService(IServerProcess.class);
IRole [] memberRoles = serverProcess.getContributorRoles(memberHandle, processArea);


I also registered the service 'com.ibm.team.process.service.IServerProcess' in the plugin.xml as a prerequisite.
<extension>

<operationAdvisor>
<description> XXX
</description>
<extensionService>
<prerequisites>
<requiredService> <requiredService>
</prerequisites>
</extensionService>
</operationAdvisor>
</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!

permanent link
shaomin xing (15643) | answered Oct 28 '11, 12:07 p.m.
JAZZ DEVELOPER
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!


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);

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.