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

Getting related ARtifacts for IWorkItems

Hi all,

I'm trying to fetch Related Artifacts (Source code snippets) for WorkItems.
To do so, I create an LinkQuery


ILinkQueryPage page = fLinkManager.findLinksBySource(new String[]{WorkItemLinkTypes.RELATED_ARTIFACT}, new IReference[]{reference}, _monitor);
ILinkCollection linkCollection = page.getAllLinksFromHereOn();

Collection<ILink> links = linkCollection.getLinksById(WorkItemLinkTypes.RELATED_ARTIFACT);


Now, the problem is how to get the name of the file or the source code entity itself.

When the target would be an IWorkItem I would call


IWorkItemHandle targetItemHandle = (IWorkItemHandle) link.getTargetRef().resolve();
IWorkItem targetItem = (IWorkItem)_auditableClient.resolveAuditable(targetItemHandle, IWorkItem.FULL_PROFILE, _monitor);


But what to do if the target is (obviuosly) no IWorkItem?

Thanks for your help.


Kim

0 votes



One answer

Permanent link
I figured it out. Here is the code in case someone is interested in it:


ILinkQueryPage page = fLinkManager.findLinksBySource(new String[]{WorkItemLinkTypes.RELATED_ARTIFACT}, new IReference[]{reference}, _monitor);
ILinkCollection linkCollection = page.getAllLinksFromHereOn();

Collection<ILink> links = linkCollection.getLinksById(WorkItemLinkTypes.RELATED_ARTIFACT);
for (ILink link : links){

IURIReference targetReference = (IURIReference) link.getTargetRef();

}

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,952

Question asked: Feb 12 '08, 9:20 a.m.

Question was seen: 7,843 times

Last updated: Feb 12 '08, 9:20 a.m.

Confirmation Cancel Confirm