How to get the categories of a given Team Area using RTC Plain Java API
![](http://jazz.net/_images/myphoto/3be4dad47810e4bd01d59ab11906724f.jpg)
One answer
![](http://jazz.net/_images/myphoto/3be4dad47810e4bd01d59ab11906724f.jpg)
One can pull in a list of the categories something like:
IWorkItemClient service = getWorkItemClient();
List<ICategory> findCategories=null;
try {
findCategories = service.findCategories(
jazzServer.getProjectArea(), ICategory.FULL_PROFILE,
jazzServer.getMonitor());
} catch (TeamRepositoryException e) {
// TODO Auto-generated catch block
logger.error("Exception",e);
}
for (ICategory category : findCategories) {
// do something with the ICategory results
if (!category_cache.containsKey(category.getHierarchicalName())) {
logger.debug("Adding category name "+category.getHierarchicalName()+" to cache.");
category_cache.put(category.getHierarchicalName(), category);
}
}
private IWorkItemClient getWorkItemClient() {
return (IWorkItemClient) jazzServer.getRepository().getClientLibrary(
IWorkItemClient.class);
}
Comments
![](http://jazz.net/_images/myphoto/3be4dad47810e4bd01d59ab11906724f.jpg)
Hello Kevin,. Thanks for your reply. This code is to get all the Categories for a given Project Area. But i need to get for the Specified Team Area.
Is there any way for getting the categories ?
![](http://jazz.net/_images/myphoto/197766eae5cac1218c9c4c8ca5d5ca58.jpg)
The ICategory class has the method
getAssociatedTeamAreas() Returns the list of associated team areas.
So you'd have to get the complete list of categories anyway, then look for the specific team area. Note that multiple categories can be mapped onto a single team.
![](http://jazz.net/_images/myphoto/3be4dad47810e4bd01d59ab11906724f.jpg)
Thanks a lot for your reply Kevin. you are mentioning about getting the Teamareas from the Categories.
But I need it in a reverse way. From the TeamAreas I need the categories associated with it.
Is there any APIs for getting this ?
![](http://jazz.net/_images/myphoto/197766eae5cac1218c9c4c8ca5d5ca58.jpg)
Sometimes one has to create new tools from those already at hand.
Comments
Geoffrey Clemm
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Oct 07 '17, 4:17 a.m.By "all categories of a given Team Area", do you mean all categories that are currently mapped to that team area? Note that the mapping can be different for different timelines, so you would need to ask "what categories are mapped to that team area in a specified timeline", or "in any timeline" (depending on what you want to use this information for). You might want to mention how you plan on using this information, in case there is a better way of addressing that use case.
Jazzuser user
Oct 09 '17, 3:26 a.m.Hello Geoffrey, Thanks for your reply.
We have a single timeline for all the Teams.
To elaborate on the usecase : I need to get the list of all the categories(its UUID) for the TeamAreas having a #notifyemail tag in the description.
So I am successfully able to read the Team's description(with #notifyemail tag). For this Teams I need to get the categories.
Is there any way I can get the categories ?
Geoffrey Clemm
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Oct 09 '17, 6:17 p.m.If by "categories of a team area", you mean the categories currently mapped to that team area, see Kevin's answer.