Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How can we get the "DuplicateOf" link programmatically (java APIs)?

We have a need to be able to programmatically determine the work item that is in the "DuplicateOf" link using plain java APIs.  So if work item 3 is returned as a "DuplicateOf" work item 2, when we are reading the attributes of work item 3, we need to be able to get down to the "work item 2" part.

Thanks
Susan

0 votes



One answer

Permanent link
Most of the API should be available in these classes and/or interfaces:

com.ibm.team.workitem.common.model.IWorkItemReferences
com.ibm.team.workitem.common.model.WorkItemEndPoints
com.ibm.team.workitem.common.model.WorkItemLinkTypes
com.ibm.team.links.common.IReference
com.ibm.team.links.common.IItemReference
and
com.ibm.team.workitem.common.IWorkItemCommon

Use IWorkItemCommon.resolveReferences to get the references of a work item. The result will be an instance of IWorkItemReferences. Then you can use getReferences(IEndPointDescriptor) to get the links of a certain type, in your case that would be WorkItemEndPoints.DUPLICATE_OF_WORK_ITEM.

Eventually, you have a list containing IReference instances, which you can cast down to IItemReference. This interface provides access to the handle of the referenced item. To get its data, use IRepositoryItemService or similar to fetch it from the repository.

Regards
Markus

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,930

Question asked: May 07 '13, 10:57 a.m.

Question was seen: 3,608 times

Last updated: May 07 '13, 11:05 a.m.

Confirmation Cancel Confirm