It's all about the answers!

Ask a question

WorkItem details from Changeset ID


Reji GL (1136) | asked Sep 17 '13, 3:52 p.m.
edited Sep 17 '13, 3:55 p.m.
The task I am trying to achieve is to fetch the WorkItem Info, given the Changeset ID. I have the ChangesetID (for e.g. a value like _GnlR8RwDEeO-t7oYqwMn0H ). With this value I need to query the WorkItem information using Plain Java APIs. 

Please provide your thoughts in achieving this.

Accepted answer


permanent link
SEC Servizi (97122549) | answered Sep 18 '13, 4:00 a.m.
If the change-set has a work-item associated, you can retrieve the work-item information using the ILinkServiceLibrary.class service:
ILinkService linkService = getService(ILinkService.class);
ILinkServiceLibrary linkServiceLibrary = (ILinkServiceLibrary) linkService.getServiceLibrary(ILinkServiceLibrary.class); ILinkCollection csLinks = linkServiceLibrary.findLinks(ILinkConstants.CHANGESET_WORKITEM_LINKTYPE_ID, reference).getAllLinksFromHereOn(); // ...
If you know the UUID of the change-set, you can create the reference to it as:
UUID uuid = UUID.valueOf("_GnlR8RwDEeO-t7oYqwMn0H");
IChangeSetHandle csH = (IChangeSetHandle)IChangeSet.ITEM_TYPE.createItemHandle(uuid, null);
IReference reference = IReferenceFactory.INSTANCE.createReferenceToItem(csH);
Cheers.
Reji GL selected this answer as the correct answer

Comments
Reji GL commented Sep 18 '13, 11:28 a.m.

Thanks for responding.


The provided solution is apt while using server side api. But I am using the client side APIs.


SEC Servizi commented Sep 19 '13, 5:14 a.m.

On client side we use ILinkManager.class, instead of ILinkServiceLibrary.class, but the behaviour is quite the same.


Reji GL commented Sep 23 '13, 5:31 p.m.

Yeah.. I go it working.. Thank you.

Your answer


Register or to post your answer.