It's all about the answers!

Ask a question

RTC Jazz Client API: How to get a work item category ID?


Clement Liu (1.5k54249) | asked Apr 21 '14, 5:15 p.m.
This is part of my code;

List<ICategory> findCategories= workItemService.findCategories(projectArea, ICategory.FULL_PROFILE, null);
Iterator<ICategory> i = findCategories.iterator();

        while(i.hasNext()){
        ICategory ic = i.next();
        ICategoryHandle categoryHandle = (ICategoryHandle)ic;
        ICategory category = (ICategory) repo.itemManager()
.fetchCompleteItem(categoryHandle, IItemManager.DEFAULT, null);

                 ........

I can use category.getName() to get category name but how can I get the category item_id? It looks like this: _4q8WEMlTEeKzqIh7h7lAkg

I tried category.g getCategoryId() but it doesn't give me what I want. 

Thansk!!!!

Accepted answer


permanent link
sam detweiler (12.5k6195201) | answered Apr 21 '14, 5:29 p.m.
edited Apr 21 '14, 5:30 p.m.
Because ICategory is an auditable, the method getItemId should work

from the SDK

getItemId

UUID getItemId()
Returns the item id of this item. The item id gives items their identity.

Returns:
the item id; never null

Clement Liu selected this answer as the correct answer

Comments
Clement Liu commented Apr 21 '14, 6:32 p.m.

Oops, I did miss that. Thank you, Sam. 


sam detweiler commented Apr 21 '14, 6:35 p.m.

and you know, in Eclipse, if you type the . after the variable name and wait, it will pop up all methods available.  and it will show you their return data types.

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.