It's all about the answers!

Ask a question

Programmatically get all work item children


Andrea Ianni (1611916) | asked Jul 28 '10, 9:15 p.m.
Hi all,
I would programmatically find all children of work item and, after, analyze the custom attribute of these.

I try in this way:
IWorkItemReferences referencesCopy = wis.resolveWorkItemReferences(wiCopy, null);	

List<IReference> links = referencesCopy.getReferences(WorkItemEndPoints.CHILD_WORK_ITEMS);
for (IReference lin : links) {
List<IAttributeHandle> childsWorkItem = ((IWorkItem)lin.getLink().getWorkingCopy()).getCustomAttributes();
for ( IAttributeHandle iah : childsWorkItem) {
IAttribute customAttribute = (IAttribute) (repositoryItemService.fetchItem(iah, null));
if (customAttribute.getIdentifier().equalsIgnoreCase("defectalreadyopened"))
{

.....

}
}
}



but I obtain this error:
java.lang.ClassCastException: com.ibm.team.links.internal.links.impl.AuditableLinkImpl incompatible with com.ibm.team.workitem.common.model.IWorkItem


Any suggestions?

Thanks
Andrea

Be the first one to answer this question!


Register or to post your answer.