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) { ... |
3 answers
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 ( IWorkItem workItem = (IWorkItem) auditable; String summary = workItem.getHTMLSummary().getPlainText(); System.out.println("Work Item Name: " + summary); } } |
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 ( 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 } |
It works now... by relaunch Eclipse application... :!:
|
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.