[closed] How can I create child team area using 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;
}
ITeamArea teamArea = (ITeamArea)teamRepository.itemManager().fetchCompleteItem(teamAreaHandle,ItemManager.DEFAULT,monitor);
if (ChildTeamID.equals(teamArea.getName())) {
return teamAreaHandle;
}
}
return null;
}
The question has been closed for the following reason: "Duplicate Question" by kushsingh Aug 01 '13, 6:52 a.m.
2 answers
here is how to create a team area
<code>
// create Team Area
ITeamArea teamArea = (ITeamArea) ITeamArea.ITEM_TYPE.createItem();
String actualTeamName = teamName + System.currentTimeMillis();
teamArea.setName(actualTeamName);
teamArea.addMember(getContributor());
area = (IProjectArea) area.getWorkingCopy();
teamArea.setProjectArea(area.getProjectArea());
</code>
in the api you meantioned, the 1st parm(arg1) is the parent team area, and the second parm (arg2)is the new child.
see the javadoc
<code>
// create Team Area
ITeamArea teamArea = (ITeamArea) ITeamArea.ITEM_TYPE.createItem();
String actualTeamName = teamName + System.currentTimeMillis();
teamArea.setName(actualTeamName);
teamArea.addMember(getContributor());
area = (IProjectArea) area.getWorkingCopy();
teamArea.setProjectArea(area.getProjectArea());
</code>
in the api you meantioned, the 1st parm(arg1) is the parent team area, and the second parm (arg2)is the new child.
see the javadoc
Comments
you need to pass the team area HANDLE
once again, please see the javadoc which is available in the product download section for each release since 3.0.1.1
once again, please see the javadoc which is available in the product download section for each release since 3.0.1.1
void addChild(ITeamAreaHandle parent, ITeamAreaHandle child)
-
Adds a given team area as a child to another given team area.
-
- Parameters:
-
parent- the parent team area -
child- the child team area - Throws:
-
TeamAreaHierarchyException- if the parent is not part of this hierarchy or the child already has a parent