Fetching change sets from work items is not working
Hi
I'm using the method that is described here multiple times to retrieve change sets that are associated with specific work items:
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?
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
You can find some information and example on how the link API works here. There are examples for usage in client and server extensions.