It's all about the answers!

Ask a question

How to get change set associated to work item using java client API


vikrant kamble (1323897) | asked Sep 08 '15, 2:17 a.m.
  Hi All,
I am trying to fetch change set associated to work item using java client API.
following is I could do so far

IItemManager itemManager = (IItemManager)teamRepository.getClientLibrary(IItemManager.class);
LinkManager linkManager = (ILinkManager)teamRepository.getClientLibrary(ILinkManager.class);
IItemReference workItemRef = IReferenceFactory.INSTANCE.createReferenceToItem(workItem);
ILinkQueryPage linkPage=linkManager.findLinks(WorkItemLinkTypes.CHANGE_SET, workItemRef, monitor);
List<IChangeSet> changeSets = new ArrayList<IChangeSet>();
for (ILink link : linkPage.getAllLinksFromHereOn())
 {
 IChangeSetHandle changeSetHandle = (IChangeSetHandle) link .getSourceRef().resolve();
 IChangeSet changeSet=(IChangeSet)itemManager.fetchCompleteItem(changeSetHandle, IItemManager.DEFAULT, monitor);
 changeSets.add(changeSet);
 }

but, 
 IChangeSet changeSet=(IChangeSet)itemManager.fetchCompleteItem(changeSetHandle,IItemManager.DEFAULT, monitor);
 at this line I am getting null pointer exception.
Is there anything I am missing here?


Thank You

Accepted answer


permanent link
vijayakumar ramesh (1173862) | answered Sep 08 '15, 2:40 a.m.
https://jazz.net/library/article/1229
in this link Example 2 would help you to solve your problem
vikrant kamble selected this answer as the correct answer

Comments
vikrant kamble commented Sep 08 '15, 3:37 a.m.

 Thank You Vijaykumar

Your answer


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