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

How to use IChangeSet to retrieve associated IWorkItem

 I know how to retrieve changeset of workitem by below link:

How do I  retrieve workitem from change set with plain java client libraries? (I associate the changeset with workitem.)

Many thanks! 

0 votes


Accepted answer

Permanent link
See this post and the associated code:

https://rsjazz.wordpress.com/2012/11/01/restrict-delivery-of-changesets-to-workitem-types-advisordelivery-of-changesets-associated-to-wrong-work-item-types-advisor/
Lee John selected this answer as the correct answer

1 vote

Comments
Hi Ralph,

Many thanks! 

Since I am use plain java client libraries, the below links solve my problem:

and your information does great help!


One other answer

Permanent link
 Just put the working code here for other's reference:
public List<IWorkItem> getLinkWorkItemFromChangeset(IChangeSetHandle changeSetHandle) throws Exception
{
    _envChk
(); // Environment check
   
List<IWorkItem> wkiList = new ArrayList<IWorkItem>();
   
List<ILink> links = ChangeSetLinks.findLinks(
                               
(ProviderFactory) TeamRepository.getClientLibrary(ProviderFactory.class),
                                    changeSetHandle
,
                                   
new String[] { ILinkConstants.CHANGESET_WORKITEM_LINKTYPE_ID },
                               
MyProgressMonitor);
   
for (final ILink lk : links) {
       
final Object resolved = lk.getTargetRef().resolve();
       
if (resolved instanceof IWorkItemHandle) {
           
IWorkItem workItem = (IWorkItem) TeamRepository.itemManager().fetchCompleteItem(
                                                               
(IWorkItemHandle)resolved,
                                                               
IItemManager.DEFAULT,
                                                               
null);
            wkiList
.add(workItem);
       
}
   
}
   
return wkiList;
}

0 votes

Comments

Thanks for sharing!

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,938

Question asked: Apr 01 '15, 4:04 a.m.

Question was seen: 3,448 times

Last updated: Apr 02 '15, 2:56 a.m.

Confirmation Cancel Confirm