Why does this code not return any changesets for the supplied IWorkItem (RTC 4.0)?
![]()
Tamir Klinger (91●1●6●5)
| asked Apr 10 '13, 3:34 p.m.
JAZZ DEVELOPER edited Apr 10 '13, 3:39 p.m. by Ralph Schoon (63.3k●3●36●46)
Following the advice from this thread I tried to get the changesets for a workitem programmatically. It doesn't seem to be returning anything for a workitem which I've verified does have a changeset. I'm wondering if something changed in the link API for this since 2012? The code snippet I'm using is shown below. What's strange is that if I debug I can see that there is a changeset link in the contents field of the ILinkQueryPage but it does not appear in the ILinkCollection obtained from it, which is an empty array in my example.
Any thoughts?
Thanks,
Tim
The code:
1. rtcConnection.getRepository() returns the ITeamRepository I'm using.
2. workItem is the IWorkItem for which I'm trying to get changesets
ILinkManager fLinkManager = (ILinkManager)rtcConnection.getRepository().getClientLibrary(ILinkManager.class); IReferenceFactory fReferenceFactory = fLinkManager.referenceFactory(); IReference reference = fReferenceFactory.createReferenceToItem(workItem.getItemHandle()); ILinkQueryPage page = fLinkManager.findLinksByTarget("com.ibm.team.filesystem.workitems.change_set", reference, null); ILinkCollection linkCollection = page.getAllLinksFromHereOn(); |
2 answers
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Apr 10 '13, 3:43 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
There is some code here https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/ that follows change set links. Maybe that helps.
Comments Hey Ralph,
Thanks for the pointer. That code looks like it uses the server-side API. I'm on the client side here. I don't see a solution to this problem there...
Tim
Tim, here is information on the client link API and the snippets shipped with the Plain Java Client Libraries mentioned here provide some entry points for the SCM client API. |
![]()
Tamir Klinger (91●1●6●5)
| answered Apr 16 '13, 11:46 a.m.
JAZZ DEVELOPER edited Apr 16 '13, 12:06 p.m.
I've cobbled together the following code to retrieve the changeset links for a supplied workitem. It came from a variety of sources including "Defect178748Snippet" (in the SDK snippets). As usual it is difficult to find documentation so your milage may vary but it works for me.
--Tim
repository is an ITeamRepository
mgr is an IItemManager
workItem is the IWorkItem for which we want changesets
items holds the set of associated changeset links for the workitem
IClientLibraryContext ctx = (IClientLibraryContext)repository; |
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.