javaapirtcworkitem

How to find work item filed against category value using plain java api?


I am using below code and found filed against category object but there I am not able to find the value. Please help.

IProjectAreaHandle projectAreaHandle = workItem.getProjectArea();

                IAttribute someAttribute = workItemClient.findAttribute(projectAreaHandle, IWorkItem.CATEGORY_PROPERTY,
                        monitor);



    IAttributeHandle iAttributeHandle = (IAttributeHandle) someAttribute;
                    IAttribute iAttribute = (IAttribute) repo
                        .itemManager().fetchCompleteItem(
                        iAttributeHandle, IItemManager.DEFAULT ,monitor);

                    Object value = workItem.getValue(iAttribute);

Solution

  • Below code will help to find out the filed against attribute value :

     ICategoryHandle iCategoryHandle = workItem.getCategory();
                    ICategory iCategory1 = (ICategory) repo
                            .itemManager().fetchCompleteItem(
                                    iCategoryHandle, IItemManager.DEFAULT ,monitor);
                    return iCategory1.getName();