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

Teams role API

Hi,
There is an api to set contributor roles for team. However since it is possible to have a project without a team, how can I set programmatically roles for a contributor at the project level?
Thanks in advance for your help


IProcessAreaWorkingCopy projWc = (IProcessAreaWorkingCopy)getService().getWorkingCopyManager().createPrivateWorkingCopy(proj);
projWc.getTeam().addContributorsSettingRoleCast(new IContributor[] {contributor}, roles);

0 votes



19 answers

Permanent link
Thanks for reply -
However you don't set a given role to a contributor at the project level - The code snippet adds a contributor (with a dev license) to a project and retrieve a given project role.
What I need is to be able to add a role at the project level for an existing contributor to the project.

You do get the role for the project via

roles[0] = getProjectsRoleName(project,roleName);

which is fine but you never assign roles to the contributor.

Am I missing something?
Thanks

0 votes


Permanent link
in the code here is add the role to the user

workingCopy.addMembers(contributors);
workingCopy.setRoleCast(contributors, roles);
workingCopy.save(MONITOR);

readding an existing user does no affect the user

0 votes


Permanent link
Thank you, however note that the setRoleCast is deprecated and therefore shoudln't be used....

workingCopy.setRoleCast(contributors[0], roles);

0 votes


Permanent link
public void setRoleCast(IContributorHandle contributor, IRole[] roleCast) {
ITeamWorkingCopy team = getTeam();
if (team != null) {
team.setRoleCast(contributor, roleCast);
}
}

0 votes


Permanent link
I retrieve

ProjectAreaWorkingCopy workingCopy = (ProjectAreaWorkingCopy)manager.getWorkingCopy(project);

this class extends to ProcessAreaWorkingCopy
public class ProjectAreaWorkingCopy extends
ProcessAreaWorkingCopy implements IProjectAreaWorkingCopy

In ProcessAreaWorkingCopy setRoleCast retreives the team and
sets the role.

It is not deprecated.

0 votes


Permanent link
This is what I was asking at the beginning of this thread...
One can set the role at the team level via

team.setRoleCast(contributor, roleCast);

or

projWc.getTeam().addContributorsSettingRoleCast(new IContributor[] {contributor}, roles);


but it cannot be set at the project level - ie the API project.setRoleCast is deprecated. However one can set role at the project level in the UI.

Thanks

0 votes


Permanent link
Hi, I am trying to achieve similar scenario and after reading the full
thread I have following questions:

1.- IProcessAreaWorkingCopy is going to be private but
ProjectAreaWorkingCopy won't?

2.- Which method is deprecated? I have compiled the code against Plain
Java Classes from RTC 3.0M6 and nothing has been marked as deprecated.

3.- Why did you say it is not working with Project Areas?
I used the commented code with a Project Area and it worked fine.

URI uri= URI.create("Testing Project Area".replaceAll(" ", "%20"));
IProjectArea pa = (IProjectArea)service.findProcessArea(uri, null, monitor);
pa = (IProjectArea)service.getMutableCopy(pa);
....
....
....
IWorkingCopyManager manager = service.getWorkingCopyManager();
manager.connect(pa);
ProjectAreaWorkingCopy workingCopy =
(ProjectAreaWorkingCopy)manager.getWorkingCopy(pa);
....
....
workingCopy.addMembers(members);
workingCopy.setRoleCast(members, roles);
workingCopy.save(monitor);
manager.disconnect(pa);

Thanks,

Chemi.

0 votes


Permanent link
Hello guys,

do we have any news on this regard?

For Beta1 API still looks the same for these classes, although I guess that the not-supported consideration is still valid, right?

Thanks!

Regards,

Jorge.

0 votes


Permanent link
Hello Guys,

Everything speaks about adding a role to users, how to do we add multiple roles to a single users.

Can anyone help ?

Regards,
Raj

0 votes

1–15 items
page 2of 1 pagesof 2 pages

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,948
× 235
× 7

Question asked: Mar 26 '10, 11:04 a.m.

Question was seen: 24,198 times

Last updated: Oct 10 '13, 11:12 a.m.

Confirmation Cancel Confirm