It's all about the answers!

Ask a question

How to get the categories of a given Team Area using RTC Plain Java API


2
1
Jazzuser user (68849) | asked Oct 06 '17, 4:57 a.m.
edited Oct 06 '17, 6:56 a.m.

Hello All,

I need to fetch all the categories of a given Team Area using RTC API. Currently am able to fetch the Team Areas from the Project Area.

Please help me in getting the categories of a TeamArea.


Thank you.


Comments
Geoffrey Clemm commented Oct 07 '17, 4:17 a.m. | edited Oct 07 '17, 4:17 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 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 commented Oct 09 '17, 3:24 a.m. | edited 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 commented Oct 09 '17, 6:17 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 If by "categories of a team area", you mean the categories currently mapped to that team area, see Kevin's answer.

One answer



permanent link
Kevin Ramer (4.5k8183200) | answered Oct 06 '17, 12:04 p.m.
edited Oct 06 '17, 12:05 p.m.

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
Jazzuser user commented Oct 09 '17, 3:27 a.m.

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 ?


Kevin Ramer commented Oct 09 '17, 8:23 a.m.

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.


Jazzuser user commented Oct 10 '17, 12:24 a.m.

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 ?


Kevin Ramer commented Oct 10 '17, 2:48 p.m.

Sometimes one has to create new tools from those already at hand.

Your answer


Register or 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.