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

How to get WorkItemHandle from ChangeSetHandle?

Hi,
I'd like to know how to get WorkItem(Handle) associated with ChangeSet(Handle)...

String linkSummary = null;
for(Iterator<IChangeSetHandle> csIter = cshl.iterator(); csIter.hasNext();){
IChangeSetHandle tempCs = csIter.next();
IChangeSet contribution = (IChangeSet) repo.itemManager().fetchCompleteItem(tempCs, IItemManager.DEFAULT, null);
IContributor author = (IContributor) repo.itemManager().fetchCompleteItem(contribution.getAuthor(), IItemManager.DEFAULT, null);

Collection<IChangeSetHandle> cshc = new ArrayList<IChangeSetHandle>();
cshc.add((IChangeSetHandle)tempCs);
List<IChangeSetLinkSummary> cslsl = wm.getChangeSetLinkSummary(cshc, null);
for (IChangeSetLinkSummary csls : (List<IChangeSetLinkSummary>) cslsl) {
linkSummary = csls.getSummary();
System.out.println("Change Set Link Summary: " + linkSummary);

List<ILinkHandle> lhl = csls.getLinks();
for (ILinkHandle lh : lhl)
{
...

0 votes



3 answers

Permanent link
I detailed next steps but exception..
Any suggestion...

ILink link = (ILink)repo.itemManager().fetchCompleteItem(lh, IItemManager.DEFAULT, null);
String linktype = link.getLinkTypeId();
if(linktype.compareTo("com.ibm.team.filesystem.workitems.change_set") == 0)
{
IAuditable auditable = (IAuditable) repo.itemManager().fetchCompleteItem(lh, IItemManager.DEFAULT, null);
if (auditable instanceof IWorkItem) {
IWorkItem workItem = (IWorkItem) auditable;
String summary = workItem.getHTMLSummary().getPlainText();
System.out.println("Work Item Name: " + summary);
}


}

0 votes


Permanent link
I have trouble in converting IAuditable to IWorkItem...
Any help?

if(linktype.compareTo("com.ibm.team.filesystem.workitems.change_set") == 0)
{
IReference targetRef = link.getTargetRef();
if (targetRef.isItemReference())
{
IItemHandle itemHandle = (IItemHandle) ((IItemReference)targetRef).getReferencedItem();
IAuditable auditable = (IAuditable) repo.itemManager().fetchCompleteItem(itemHandle, IItemManager.DEFAULT, monitor);

if (auditable instanceof IWorkItem) {
IWorkItem workItem = (IWorkItem) auditable;
String summary = workItem.getHTMLSummary().getPlainText();
System.out.println("Work Item Name: " + summary);
}

always fell into ..
} finally {
advisorMonitor.done(); // mark monitor done in case advisor fails to do so
}

0 votes


Permanent link
It works now... by relaunch Eclipse application... :!:

0 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,939

Question asked: Feb 04 '10, 3:18 a.m.

Question was seen: 6,857 times

Last updated: Feb 04 '10, 3:18 a.m.

Confirmation Cancel Confirm