List and Create Links of a WorkItem in Java Plain API RTC
Hello, please can provide a very simple example on:
1) List Links of a given WorkItem
2) Create a link of a given WorkItem of "Related Artifacs" type.
In my code I only have the workItem:
workItem = workItemClient.findWorkItemById(workItemNumber, IWorkItem.FULL_PROFILE, new SysoutProgressMonitor())
How should I continue ?
Thanks for the help.
Accepted answer
It will look something like the following:
import com.ibm.team.links.client.ILinkManager; import com.ibm.team.links.common.IReference; import com.ibm.team.links.common.factory.IReferenceFactory; import com.ibm.team.workitem.common.model.WorkItemLinkTypes ...final ILinkManager linkManager =
(ILinkManager) repo.getClientLibrary(ILinkManager.class);
final IReference workItemRef =
linkManager.referenceFactory().createReferenceToItem(workItemHandle);
final IReference relatedRef = IReferenceFactory.INSTANCE.createReferenceFromURI(
relatedUri, comment);
final ILink newLink = linkManager.createLink(
WorkItemLinkTypes.RELATED_ARTIFACT, workItemRef, relatedRef); linkManager.saveLink(newLink, monitor);
Comments
showing 5 of 9
show 4 more comments