It's all about the answers!

Ask a question

How to automate tam area creation in a project in RTC ?


swapna das (3323467) | asked Aug 08 '16, 9:34 a.m.
edited Aug 11 '16, 7:00 a.m. by Ralph Schoon (58.0k23642)

Hi Team,

    We are using Rational CLM 6.0.1 .  We have created couple of project areas in RTC. We are having a requirement to create "n" number of teams in the project areas  and to add users to each and every team area.

Is there any automate process available to create team areas  and users to the team areas  in RTC ?

Thanks in Advance,

Swapna Das

Accepted answer


permanent link
Ralph Schoon (58.0k23642) | answered Aug 08 '16, 9:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi,

it is possible to use the API's especially the Plain Java Client Library to create team areas and assign users. There is a Snippet that ships with the plain java client libraries that creates a project area ans also a team area, snippet3.java I believe.
I am pretty sure this has also discussed here in the forum and there is example code but I was not able to find a lot using https://www.google.com/search?q=ITeamArea+fite:jazz.net.
Here some example code


	public static ITeamArea createTeamArea(String teamAreaName,
			IProjectArea projectArea, IProcessItemService itemService,
			IProgressMonitor monitor) throws TeamRepositoryException {
		ITeamArea teamArea = itemService.createTeamArea();
		teamArea.setName(teamAreaName);
		//teamArea.addMember(teamRepository.loggedInContributor());
		teamArea.setProjectArea(projectArea);
		projectArea = (IProjectArea) itemService.getMutableCopy(projectArea);
	
		projectArea.getTeamAreaHierarchy().addRoot(teamArea,
				projectArea.getDevelopmentLines()[0]);
		IProcessItem[] items = itemService.save(new IProcessItem[] {
				projectArea, teamArea }, monitor);
		teamArea = (ITeamArea) items[1];
	
		IProcessAreaWorkingCopy areaWc = (IProcessAreaWorkingCopy) itemService
				.getWorkingCopyManager().createPrivateWorkingCopy(teamArea);
		areaWc.save(monitor);
		return teamArea;
	}

	public static void addMemberToProcessArea(IContributor user, IRole role,
			IProcessArea processArea, IProcessItemService itemService,
			IProgressMonitor monitor) throws TeamRepositoryException {
		IProcessAreaWorkingCopy areaWc = (IProcessAreaWorkingCopy) itemService
				.getWorkingCopyManager().createPrivateWorkingCopy(
						processArea);
		areaWc.getTeam().addContributorsSettingRoleCast(
				new IContributor[] { user }, new IRole[] { role });
		areaWc.save(monitor);
	}

swapna das selected this answer as the correct answer

Comments
swapna das commented Aug 11 '16, 6:35 a.m.

Thanks Ralph for your quick response.

By using the code snippet , I am able to create "n" number of team areas under my project.

Can you please help me how to add a list of users to the newly created team areas with their respective roles ?

Swapna


Ralph Schoon commented Aug 11 '16, 6:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This is really scary. You did not recognize the method that I pasted as well?

addMemberToProcessArea

Your answer


Register or to post your answer.