Adding child not working using Java Api
![]()
Hi,
I tried adding parent to a workitem. It worked.But when I go to the parent workitem, I cant see the child. Am I missing something. Regards, Sudipto |
Accepted answer
![]()
Ralph Schoon (63.3k●3●36●46)
| answered Aug 27 '15, 9:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Creating a work item to work item link would look like
private static class LinkWorkItemOperation extends WorkItemOperation { private IWorkItemHandle fOpposite; private IEndPointDescriptor fEndpointDescriptor; public LinkWorkItemOperation(IEndPointDescriptor endpointDescriptor, IWorkItemHandle opposite) { super("Linking Work Item", IWorkItem.FULL_PROFILE); fOpposite = opposite; fEndpointDescriptor = endpointDescriptor; } @Override protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException { IItemReference reference = IReferenceFactory.INSTANCE .createReferenceToItem(fOpposite); workingCopy.getReferences().add(fEndpointDescriptor, reference); } }Where you would call the operation with LinkParentWorkItemOperation operationParent = new LinkWorkItemOperation( ILinkTypeRegistry.INSTANCE.getLinkType( WorkItemLinkTypes.PARENT_WORK_ITEM) .getSourceEndPointDescriptor(), linkdest); operationback.run(opposite, monitor);Opposite and linkdest being the work items. Sudipto Sarkar selected this answer as the correct answer
|
One other answer
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.
Comments
usually, this problem is because the source (from) and destination(to) workitems are backwards when you create the parent link.