It's all about the answers!

Ask a question

How to get WorkItemHandle from ChangeSetHandle?


Dong Young Kim (1931920) | asked Feb 04 '10, 3:18 a.m.
JAZZ DEVELOPER
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



permanent link
Dong Young Kim (1931920) | answered Feb 04 '10, 7:45 a.m.
JAZZ DEVELOPER
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);
}


}

permanent link
Dong Young Kim (1931920) | answered Feb 04 '10, 9:20 a.m.
JAZZ DEVELOPER
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
}

permanent link
Dong Young Kim (1931920) | answered Feb 04 '10, 9:30 a.m.
JAZZ DEVELOPER
It works now... by relaunch Eclipse application... :!:

Your answer


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