Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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:

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?

0 votes



2 answers

Permanent link
You can find some information and example on how the link API works here. There are examples for usage in client and server extensions.

0 votes


Permanent link
On the second last line where you call linkCollection.getLinksById() you could instead call linkCollection.iterator() and use the iterator to iterate over the collection of ILinks. For each ILink you can call link.getSourceRef().resolve() to get the changeset item.

I hope that this helps.

2 votes

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,930
× 411
× 149

Question asked: Oct 23 '12, 5:14 a.m.

Question was seen: 5,727 times

Last updated: Feb 21 '13, 7:56 a.m.

Confirmation Cancel Confirm