Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

[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!

1

0 votes



4 answers

Permanent link
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.

1 vote


Permanent link
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!

1 vote

Comments

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?

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.


1 vote

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

0 votes


Permanent link
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!

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,930

Question asked: Oct 27 '11, 1:04 p.m.

Question was seen: 6,608 times

Last updated: Jul 16 '14, 2:29 p.m.

Confirmation Cancel Confirm