Teams role API
EclipseTalk . (327●3●60●61)
| asked Mar 26 '10, 11:04 a.m.
retagged Jan 04 '13, 7:05 a.m. by Morten Madsen (305●31●50)
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
|
19 answers
Jared Burns (4.5k●2●9)
| answered Mar 26 '10, 11:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
On Fri, 26 Mar 2010 15:08:01 +0000, eclipsetalk wrote:
Hi, The "IProcessAreaWorkingCopy" interfaces should not be in public API packages. This is a defect that we will likely resolve in Foundation 3.0. It's recently (yesterday) come to my attention that there are examples on jazz.net encouraging people to use these interfaces, but these examples are wrong and I'll work on getting them removed. Can you explain why you're interested in modifying role assignments via a Java API? -- Jared Burns Jazz Process Team |
Thanks for the reply.
I need to be able to set/get roles at the project level and/or team level via APIs for service methods. Roles can be accessed at the team level through ITeamArea but I need something similar to access roles at the project level. Thanks for your help. |
Can you explain why you're interested in modifying role assignments via a Java API? For us the reason is automation. Reducing manual intervention is an important part of keeping overhead low when maintaining hundreds of users in nine project areas across three RTC instances -- and that'll very likely grow in the near future. Once a user is approved for a project we add them to LDAP, put the user in RTC, give them a license, add them to the project area, and finally give them a role. I have all of the pieces except the team role, and I'm having a devil of a time finding a public API to do this. The only one available is the one you say isn't valid :) Is there an alternative? |
I still haven't seen any replies from the Jazz team as for directions.
fyi - I've entered an enhancement: https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=111573 Thanks |
I still haven't seen any replies from the Jazz team as for directions. I was able to get some guidance off-line, though it uses a private API. Your enhancement request is good, but I think should have higher focus IMO. There are lots of people who want to provide their own convenient sign-on sites, and this is a major gap. Here's my code:
RolePersistence is the internal class, so is subject to change. Since that's the only private class I'm sure it wouldn't be insurmountable to provide a public abstraction. |
Thanks for sharing - yes, that's what I'm using (TeamData) to set roles at the team level but for project level there is no API, nothing, nada - Roles can only be set a the team level. I haven't found any way to set project role even via private API - If anyone knows please share.
Thank you |
Thanks for sharing - yes, that's what I'm using (TeamData) to set roles at the team level but for project level there is no API, nothing, nada - Roles can only be set a the team level. I haven't found any way to set project role even via private API - If anyone knows please share. Ah, need to brush up on good ol' reading comprehension :) Good luck with it! |
ITeamData getTeamData() is public API on IProcessArea, the supertype of IProjectArea and ITeamArea.
|
ITeamData getTeamData() is public API on IProcessArea, the supertype of IProjectArea and ITeamArea. Yes, one can get the project roles via
But there is no way to set project roles (only at the team level).
Why is the API missing for project? Thanks |
some of the functions are missing getUserById,getProjectByName ...I think you can figure out how they work.......
public IRole getProjectsRoleName(IProjectArea project,String role_name) throws TeamRepositoryException{ IRole return_role = null; IProcessItemService service = (IProcessItemService)repo.getClientLibrary(IProcessItemService.class); IClientProcess client_service = service.getClientProcess(project,MONITOR); IRole[] availableRoles = client_service.getRoles(project,MONITOR); int i = 0; for (int k = 0; k < availableRoles.length && i < 1; k++) { String role = availableRoles.getId(); if (role.compareTo(role_name) == 0) { return_role = availableRoles; i++; } } return return_role; } public String addUserToProject(String projectName, String user, String roleName) throws TeamRepositoryException{ String msg = "Added user to project " + projectName + " with Role " + roleName; IRole[] roles = {null}; IContributor[] contributors = {null}; // Get user try { contributors = getUserById(user); } catch (TeamRepositoryException e) { return ("ERROR:"); } // Add contributor licenses contributors = (IContributor)contributors.getWorkingCopy(); ILicenseAdminService licenseService = (ILicenseAdminService)((TeamRepository)repo).getServiceInterface(ILicenseAdminService.class); IContributorLicenseType license_types[] = licenseService.getLicenseTypes(); // Assign new user as a developer, test box has no floating licenses for(IContributorLicenseType license_type : license_types){ String id = license_type.getId(); if(id.equals(FLOATING_DEVELOPER_LICENSE_STRING)) { licenseService.assignLicense(contributors, id); } } contributors = repo.contributorManager().saveContributor(contributors, MONITOR); // Get Project IProjectArea project = getProjectByName(projectName); if(project == null) throw new TeamRepositoryException("Could not find project " + projectName); // Get user role roles = getProjectsRoleName(project,roleName); if (roles == null) { throw new TeamRepositoryException("Could not find role " + roleName); } IProcessItemService service = (IProcessItemService)repo.getClientLibrary(IProcessItemService.class); IWorkingCopyManager manager = service.getWorkingCopyManager(); manager.connect(project); ProjectAreaWorkingCopy workingCopy = (ProjectAreaWorkingCopy)manager.getWorkingCopy(project); workingCopy.addMembers(contributors); workingCopy.save(MONITOR); manager.disconnect(project); return msg; } |
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.