Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

[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;
}

0 votes


The question has been closed for the following reason: "Duplicate Question" by kushsingh Aug 01 '13, 6:52 a.m.


2 answers

Permanent link
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

0 votes

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. 


Permanent link
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
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

0 votes

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
        
which means you should be able to pass the teamArea object created with

 ITeamArea teamArea = service.createTeamArea();

to the addChild() method

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Jun 30 '13, 1:42 a.m.

Question was seen: 4,567 times

Last updated: Aug 01 '13, 6:52 a.m.

Confirmation Cancel Confirm