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

Programmatic get of all TeamAreas in a project

I'm sorry if this is very elementary, but I'm new at the java libs.

I am attempting to list out all of the Team Areas in a project.

I can get the projectArea just fine, and can print out. T

IProjectArea projectArea = SESSION.getProjectArea();
if (projectArea != null) {
System.out.println ("Project area: " + projectArea.getName ());
List teamAreas = projectArea.getTeamAreas();
for (int i=0;i<teamAreas.size();i++) {
ITeamAreaHandle teamArea = (ITeamAreaHandle)teamAreas.get(i);
}
}

It looks like I can do getTeamAreas() and get a list of the team areas. However, I have been very unsuccessful at printing out the names of the Team Areas. I have tried going through the list, and while I can get the ITeamAreaHandle, I don't find a way to actually get the name. If I try to use ITeamArea instead of ITeamAreaHandle, I get a ClassCastException:

ITeamArea teamArea = (ITeamArea)teamAreas.get(i);
System.out.println(teamArea.getName());

Thanks in Advance
Susan

0 votes



11 answers

Permanent link
The team area handle you get is just a reference to the real team area. If
your code is running in server side, you can use
IRepositoryItemService.fetchItems() to retrieve the real team areas. If
your code is running in client side, you can use
IItemManager.fetchCompleteItem().

0 votes


Permanent link
Hi Susan,

Did you finally achieved what you were looking for? I'm experiencing the same problem but can't find any option. I'm trying to find a way to access TeamArea through IItemManager.fetchCompleteItem() but I've been unsuccesfull.

If you finaly found a solution could you share it? Or post an example?

Thanks!

0 votes


Permanent link
The team area handle you get is just a reference to the real team area. If
your code is running in server side, you can use
IRepositoryItemService.fetchItems() to retrieve the real team areas. If
your code is running in client side, you can use
IItemManager.fetchCompleteItem().


I am still unable to get the actual name.
if (projectArea != null) {
System.out.println ("Project area: " + projectArea.getName ());
List<ITeamAreaHandle> teamAreas = projectArea.getTeamAreas();
for (int i=0;i<teamAreas.size();i++) {
ITeamAreaHandle teamArea = (ITeamAreaHandle)teamAreas.get(i);
IItem item = im.fetchCompleteItem(teamArea,
IItemManager.DEFAULT,
_monitor);
System.out.println(item.getItemType());
// System.out.println(item.getName());
}
}

I can get the itemType, although it comes out quite ugly
com.ibm.team.repository.common.model.impl.ItemTypeImpl@43be43be (namespaceURI: com.ibm.team.process, name: TeamArea, abstract: false)

But the getName() doesn't work and I haven't found the right method on the item to actually get the actual name. If I do a toString, I do see the right name in there under the name:
Proxy of com.ibm.team.process.internal.common.impl.TeamAreaImpl@61586158 (stateId: , itemId: , origin: com.ibm.team.repository.client.internal.TeamRepository@52be52be, immutable: true) (contextId: , modified: 2011-04-26 09:34:40.03, workingCopy: <unset>) (mergePredecessor: null, workingCopyPredecessor: <unset>, workingCopyMergePredecessor: <unset>, predecessor: ) (descSummary: NGI - Common Installer, archived: false, name: NGI - Common Installer, uniqueName: _TeTgsGGvEd6-Y-pxdzN8BA)

(the name I want is NGI - Common Installer)

Any more help?

Susan

0 votes


Permanent link
I'm sorry if this is very elementary, but I'm new at the java libs.

I am attempting to list out all of the Team Areas in a project.

I can get the projectArea just fine, and can print out. T

IProjectArea projectArea = SESSION.getProjectArea();
if (projectArea != null) {
System.out.println ("Project area: " + projectArea.getName ());
List teamAreas = projectArea.getTeamAreas();
for (int i=0;i<teamAreas.size();i++) {
ITeamAreaHandle teamArea = (ITeamAreaHandle)teamAreas.get(i);
}
}

It looks like I can do getTeamAreas() and get a list of the team areas. However, I have been very unsuccessful at printing out the names of the Team Areas. I have tried going through the list, and while I can get the ITeamAreaHandle, I don't find a way to actually get the name. If I try to use ITeamArea instead of ITeamAreaHandle, I get a ClassCastException:

ITeamArea teamArea = (ITeamArea)teamAreas.get(i);
System.out.println(teamArea.getName());

Thanks in Advance
Susan


Susan, handles need to get resolved to get at the actual object. Please try TeamRepository.itemManager().fetchCompleteItem(handle,0,null);

Or use auditableClient.resolveAuditable(). You need to get the client library first.

0 votes


Permanent link
I'm sorry if this is very elementary, but I'm new at the java libs.

I am attempting to list out all of the Team Areas in a project.

I can get the projectArea just fine, and can print out. T

IProjectArea projectArea = SESSION.getProjectArea();
if (projectArea != null) {
System.out.println ("Project area: " + projectArea.getName ());
List teamAreas = projectArea.getTeamAreas();
for (int i=0;i<teamAreas.size();i++) {
ITeamAreaHandle teamArea = (ITeamAreaHandle)teamAreas.get(i);
}
}

It looks like I can do getTeamAreas() and get a list of the team areas. However, I have been very unsuccessful at printing out the names of the Team Areas. I have tried going through the list, and while I can get the ITeamAreaHandle, I don't find a way to actually get the name. If I try to use ITeamArea instead of ITeamAreaHandle, I get a ClassCastException:

ITeamArea teamArea = (ITeamArea)teamAreas.get(i);
System.out.println(teamArea.getName());

Thanks in Advance
Susan


Susan, handles need to get resolved to get at the actual object. Please try TeamRepository.itemManager().fetchCompleteItem(handle,0,null);

Or use auditableClient.resolveAuditable(). You need to get the client library first.


Thanks .. I had gotten a little further today, and had used the fetchCompleteItem but still can't find a method call to get the Name.

IItem item = im.fetchCompleteItem(teamArea,
IItemManager.DEFAULT,
_monitor);
System.out.println(item.getItemType());
// System.out.println(item.getName());

0 votes


Permanent link
I would try to fetch not to IItem, but to ITeamArea if possible.

0 votes


Permanent link
One more thing: Set the SDK up as described in the Extensions workshop in the library. Then add the Plain Java API as a user library. Then you can search the SDK.

Try to find places where the ITemaAreaHandle or ITeamArea is used. That is how I find out how to get to data.

0 votes


Permanent link
You should use ITeamArea to get the name. For example:

ITeamArea item = (ITeamArea )im.fetchCompleteItem(teamArea,
IItemManager.DEFAULT,
_monitor);
String name = item.getName();

0 votes


Permanent link
Susan, were you able to resolve the issue?

0 votes


Permanent link
Susan, were you able to resolve the issue?


For the most part ... I am able to the the bottom Team Area name but it doesn't give me the full path or hierarchy.

I see that I can get:
Name
Description
Members and their roles on the team

What I need in the end is:
Full Path Name (like Feature Teams/Security Feature Team vs Test Teams/Persona Test Team
Description (this is good I think)
Members (I can get the IContributor[], so I think I'm good here)
Roles ... I'm not sure how to get what Role "Joe" has in this TeamArea.

Susan

0 votes

Comments

I am close but not quite there.  What I still haven't been able to get are:
1) I can get the team area name, but not the path with the parent hierarchy
2) I cannot seem to get the description, getDescription.getSummary() seems blank and getDescription.getDetails I can get content type but not content.
3) I can get Members (name, email, ID) but I cannot get what Role(s) they have on that individual team.

I run out of characters iwth the code, will add another comment with code.

Susan

ITeamAreaHandle teamAreaHandle = (ITeamAreaHandle)teamAreas.get(i);
ITeamArea teamArea = (ITeamArea)rtcm.getRepository().itemManager().fetchCompleteItem(teamAreaHandle,0,null);
name = teamArea.getName();
summary = teamArea.getDescription().getSummary();
IContent content = teamArea.getDescription().getDetails();
details = content.getContentType();
IContributorHandle[] ic = teamArea.getMembers();
for (int j=0;j<ic.length;j++) {
   IContributor fullPerson = (IContributor)rtcm.getRepository().itemManager().fetchCompleteItem(ic[j],0,null);      }


1–15 items
page 1of 1 pagesof 2 pages

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

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: Jan 16 '11, 3:16 p.m.

Question was seen: 9,864 times

Last updated: Sep 28 '12, 3:13 a.m.

Confirmation Cancel Confirm