creating child team area using plain Java API
ITeamArea teamArea = (ITeamArea)teamRepository.itemManager().fetchCompleteItem(teamAreaHandle,ItemManager.DEFAULT,monitor);
if (ChildTeamID.equals(teamArea.getName())) {
return teamAreaHandle;
}
}
return null;
}
Accepted answer
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);
3 other answers
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.
The way the snippet3 works indicates, to do what you want, you likely have to get the team area you want to add a child, get the project area, its workingCopy from that. Then add the new team area as child as in the example code above.
Hello everyone, thank you very much Ralph for everything, in a few days I will also reply to the other post with the closure of my attempts.
Comments
It is our intention to make this batch a rest service if I succeed I would like to share the source with you, what should I do? Sorry for the OT but I think it can be useful for other users too.