Teams role API
![](http://jazz.net/_images/myphoto/c82e54de68bf0d69f704a97a9de7772f.jpg)
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
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);
19 answers
![](http://jazz.net/_images/myphoto/c82e54de68bf0d69f704a97a9de7772f.jpg)
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
which is fine but you never assign roles to the contributor.
Am I missing something?
Thanks
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
![](http://jazz.net/_images/myphoto/c82e54de68bf0d69f704a97a9de7772f.jpg)
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.
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.
![](http://jazz.net/_images/myphoto/c82e54de68bf0d69f704a97a9de7772f.jpg)
This is what I was asking at the beginning of this thread...
One can set the role at the team level via
but it cannot be set at the project level - ie the APIproject.setRoleCast is deprecated. However one can set role at the project level in the UI.
Thanks
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
Thanks
![](http://jazz.net/_images/myphoto/c82e54de68bf0d69f704a97a9de7772f.jpg)
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.
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.
page 2of 1 pagesof 2 pages