Programmatic get of all TeamAreas in a project
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
11 answers
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!
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
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.
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());
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
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); }