creating child team area using plain Java API
![]()
How can I create child team areas while creating teamarea. Pasting the below piece of code which I feel should create the child team area but it doesn't. I think my mistake is I am not able to get the child team area name in a handle. Looking at the code below, if someone can help, will be great.
List <teamareahandle> teamlist = area.getTeamAreas();
childTAHandle = findChildTeamArea(teamlist,childteamAreaName,monitor);
area.getTeamAreaHierarchy().addChild(teamArea,childTAHandle);
the method: findChildTeamArea is:
public ITeamAreaHandle findChildTeamArea (List<teamareahandle> teamlist, String ChildTeamID, IProgressMonitor monitor) throws TeamRepositoryException {
for (ITeamAreaHandle teamAreaHandle : teamlist) {
ITeamArea teamArea = (ITeamArea)teamRepository.itemManager().fetchCompleteItem(teamAreaHandle,ItemManager.DEFAULT,monitor); if (ChildTeamID.equals(teamArea.getName())) { return teamAreaHandle; } } return null; } |
Accepted answer
![]()
Ralph Schoon (57.5k●2●36●42)
| answered Jul 30 '13, 11:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Jul 30 '13, 11:33 a.m.
The Code of Snippet 3 of the Plain Java Client Libraries can be changed this way to create a child team area:
IProjectArea area = service.createProjectArea(); area.setName(projectName + " - " + System.currentTimeMillis()); area.setProcessDefinition(definitions[0]); IDescription description = area.getDescription(); description.setSummary(projectName + " example project based on the Scrum project template"); area = (IProjectArea) service.save(area, monitor); area = (IProjectArea) service.getMutableCopy(area); // Create team 1 ITeamArea teamArea = service.createTeamArea(); teamArea.setName(projectName); teamArea.addMember(repo.loggedInContributor()); teamArea.setProjectArea(area); // Set Root area.getTeamAreaHierarchy().addRoot(teamArea, area.getDevelopmentLines()[0]); // Create team 2 ITeamArea teamArea2 = service.createTeamArea(); teamArea2.setName(projectName+" 1"); teamArea2.addMember(repo.loggedInContributor()); teamArea2.setProjectArea(area); // add child to Team 1 area.getTeamAreaHierarchy().addChild(teamArea, teamArea2); // Save all new items IProcessItem[] items = service.save(new IProcessItem[] {area, teamArea, teamArea2}, monitor); Kaushambi Singh selected this answer as the correct answer
|
2 other answers
![]()
Ralph Schoon (57.5k●2●36●42)
| answered Jul 30 '13, 7:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I think this was already answered in https://jazz.net/forum/questions/118159/how-can-i-create-child-team-area-using-java-api I would assume you need a working copy to do a save.
Comments Hi Ralph, I did save at end but its still not creating the child team area.
service.save(new IProcessItem[] {area, teamArea},null);
|
![]()
Hi Ralph,
I also want to know how can I add child team areas in an already existing team area. I think we need to have process area working copy for this but then I am not getting the method getTeamAreaHierarchy() with that in the method list.
teamArea2 = (ITeamArea)ta.teamRepository.itemManager().fetchCompleteItem(TAHandle,IItemManager.DEFAULT,monitor);
IProcessAreaWorkingCopy areaWc = (IProcessAreaWorkingCopy)service.getWorkingCopyManager().createPrivateWorkingCopy(teamArea2);
But I don't find getTeamAreaHierarchy() method when I do areaWC.
Comments I would suggest to use the techniques described here: https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ to look for code. Eventually you have to master that techniques, if you want to use the API. We can't support an real-time online tutorial and code example service in the forum. For the answer above I had to spend half an hour myself to figure it out and this is obviously not sustainable.
|