It's all about the answers!

Ask a question

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

vikrant kamble (1322896) | 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);

 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 (1173660) | answered Sep 08 '15, 2:40 a.m.
in this link Example 2 would help you to solve your problem
vikrant kamble selected this answer as the correct answer

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

 Thank You Vijaykumar

Your answer

Register or to post your answer.