如何使用javaAPI获取RTC工作项属性数据?

How to get RTC work item attribute data using java API?

我正在使用下面的代码,它 returns 一些关于 "Filed Against" 的信息 属性。但是我在那里找不到属性数据。请帮助

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

使用下面的代码通过 Id 查找工作项:

workItemClient = (IWorkItemClient) repo.getClientLibrary(IWorkItemClient.class);
                int id = new Integer("339406").intValue();  
                IWorkItem workItem = workItemClient.findWorkItemById(id, IWorkItem.FULL_PROFILE, monitor);

使用此工作项,我想获取与该工作项相关的父项和子项,例如 Epic 和故事工作项。然后是故事状态、故事计划等属性

来自this thread

You can't just put a string in there, I think.
You have to find the category object from the string and then put in the ICategory object.

这意味着:

private static String CATEGORY_NAME = "UI1"; 
List<ICategory> findCategories = workItemCommon.findCategories(projectArea, ICategory.FULL_PROFILE, monitor); 
    for(ICategory category : findCategories) { 
          if(category.getName().contains(CATEGORY_NAME)){ 
              filedAgainstAttribute = QueryableAttributes.getFactory(IWorkItem.ITEM_TYPE).findAttribute(projectArea, IWorkItem.CATEGORY_PROPERTY, auditableClient, monitor); 
                    filedAgainstExpression = new AttributeExpression(filedAgainstAttribute, AttributeOperation.EQUALS, category);
       } 
  }