Fetching change sets from work items is not working
S M (86●2●20●23)
| asked Oct 23 '12, 5:14 a.m.
retagged Feb 21 '13, 7:56 a.m. by Morten Madsen (305●32●50)
Hi
I'm using the method that is described here multiple times to retrieve change sets that are associated with specific work items: public List<IChangeSet> getChangeSets(IWorkItem workItem) { List<IChangeSet> changeSets = new ArrayList<IChangeSet>(); ILinkManager linkManager = (ILinkManager) repository.getClientLibrary(ILinkManager.class); IReferenceFactory referenceFactory = linkManager.referenceFactory(); IReference reference = referenceFactory.createReferenceToItem(((com.ibm.team.workitem.common.model.IWorkItem) workItem.getInternalRepresentation()).getItemHandle()); System.out.println(workItem.getTitle()); ILinkQueryPage linkQueryPage = null; try { linkQueryPage = linkManager.findLinksByTarget("com.ibm.team.filesystem.workitems.change_set", reference, monitor); } catch (TeamRepositoryException e) { e.printStackTrace(); } ILinkCollection linkCollection = linkQueryPage.getAllLinksFromHereOn(); //Put the ILinks in a list. List<ILink> linksById = (List<ILink>)linkCollection.getLinksById("com.ibm.team.filesystem.workitems.change_set"); return changeSets;} The problem is that I don't get any links at all. I tried to get all Links for a work item and then I get some links, but all of them are of the type textual and I don't get any change set links. What am I doing wrong? |
2 answers
On the second last line where you call linkCollection.getLinksById() you could instead call linkCollection.iterator() and use the iterator to iterate over the collection of ILinks. For each ILink you can call link.getSourceRef().resolve() to get the changeset item.
I hope that this helps. |
Ralph Schoon (63.7k●3●36●48)
| answered Nov 09 '12, 6:14 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You can find some information and example on how the link API works here. There are examples for usage in client and server extensions.
|
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.