It's all about the answers!

Ask a question

API JAVA : Find the type of workitem childs


Antoine LELEU (5012728) | asked May 02 '13, 5:55 a.m.
 Hello,

i try to get the type of the workitems child from a Parent.

i can find the references with this code :

IWorkItemReferences references = 
wiServer.resolveWorkItemReferences(currentWorkItem, null);
List<IReference> listChilds =      references.getReferences(WorkItemEndPoints.CHILD_WORK_ITEMS);

But i don't know how catch the type of this workitems child from the reference list.

Thanks for your help..

antoine

One answer



permanent link
Sylvain LEQUEUX (2132728) | answered May 02 '13, 8:16 a.m.
Hello,

Maybe something like this :

for(IReference ref : listChilds) {
  if(ref.isItemReference()) {
    IItemReference refItem = (IItemReference) ref;
    IItemHandle itemHandle = refItem.getReferencedItem();
    IItem item = repo.itemManager().fetchCompleteItem(itemHandle, IItemManager.DEFAULT, null);
    if(item instanceof IWorkItem) {
      System.out.println(((IWorkItem)item).getWorkItemType());
    }
  }
}

Regards,
Sylvain

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.