[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
Thanks for the reply. I already have created the team area.I would like to know the syntax for the second parameter (arg2) for child team areas. please reply.
To make my comment more clear on what I am looking for :
ITeamArea teamArea = service.createTeamArea();
projectarea.getTeamAreaHierarchy().addChild(teamArea, TAHandle arg2) ;
Please help me how to get the arg2 value ? What should be the syntax for arg2 where we are passing the child teamarea name.
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
Comments
I understood this addChild method from the doc but my question still remains, can you help me with an example syntax of argument (ITeamAreaHandle child) .Probably I am not getting how to pass this argument so an example syntax would be very helpful.
Please reply.
once again please see the javadoc, you should have noticed
-
public interface ITeamArea extends ITeamAreaHandle
ITeamArea teamArea = service.createTeamArea();
to the addChild() method