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 |
11 answers
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(). |
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! |
The team area handle you get is just a reference to the real team area. If 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 |
Ralph Schoon (63.1k●3●36●46)
| answered Sep 08 '11, 8:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER I'm sorry if this is very elementary, but I'm new at the java libs. 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. 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()); |
Ralph Schoon (63.1k●3●36●46)
| answered Sep 08 '11, 8:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I would try to fetch not to IItem, but to ITeamArea if possible.
|
Ralph Schoon (63.1k●3●36●46)
| answered Sep 08 '11, 8:43 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
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. |
You should use ITeamArea to get the name. For example:
ITeamArea item = (ITeamArea )im.fetchCompleteItem(teamArea, IItemManager.DEFAULT, _monitor); String name = item.getName(); |
Ralph Schoon (63.1k●3●36●46)
| answered Sep 26 '11, 2:51 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Susan, were you able to resolve the issue?
|
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
Susan Hanson
commented Sep 28 '12, 3:09 a.m.
I am close but not quite there. What I still haven't been able to get are:
Susan Hanson
commented Sep 28 '12, 3:13 a.m.
ITeamAreaHandle teamAreaHandle = (ITeamAreaHandle)teamAreas.get(i);
|
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.