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

Unable to create a parent link type

Hi,
LinkWorkItemOperation  is my custom private class.
I have below code,
 LinkWorkItemOperation operation =
          new LinkWorkItemOperation(ILinkTypeRegistry.INSTANCE.getLinkType(linkType).getTargetEndPointDescriptor(),
              targetWorkItem);
      operation.run(sourceWorkItem, monitor);

In the above code I can able to create other link types ex: tracks, contributes...
When I try to create a parent link I am getting the below exception.

com.ibm.team.repository.common.TeamRepositoryException: Change would introduce non-item reference for item end point
    at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.saveAddedLinks(WorkItemRepositoryService.java:1008)
    at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.saveLinks(WorkItemRepositoryService.java:951)
    at com.ibm.team.workitem.service.internal.WorkItemRepositoryService.plainSave(WorkItemRepositoryService.java:656)
    at com.ibm.team.workitem.service.internal.WorkItemProcessAreaOperation.run(WorkItemProcessAreaOperation.java:45)
........

Am I doing anything wrong here? Please help me on this.

0 votes



One answer

Permanent link
The error message says it all:

com.ibm.team.repository.common.TeamRepositoryException: Change would introduce non-item reference for item end point

If you create links, there are different ways how to create the end point. One way is an item reference e.g. based on a work item. Another is based on a location - these are used for CLM links e.g. tracks. You apparently create one of the end points not as item reference

If you pass an URI to the code, look at the different URI's you get in the web UI for different link ends. There are different forms for the different link types..

0 votes

Comments

Hi Schoon,

Thanks for your reply. I have changed my code to create the IReference according to the linktype endpoint reference.
As like below code,

 if (!this.targetEndPointDescriptor.isItemReference()) {
       "create reference from URI"           
      }
      else {
      ".createReferenceToItem"
      }

It's working fine. But is it the right approach?

When I developed the Work Item Command Line, I ran into the issue of the different types and you simply have to find out which URI/endpoint type you need.

If you pass an URI to the code, look at the different URI's you get in the web UI for different link ends. There are different forms for the different link types.

I has to basically figure what to use where. The best test s to create a link and to try to follow it from both ends and to try to delete it. Also, does it display like one such a link created by the tool.

If not, check directions and URI formats until you get it right. Sorry, I have no better answer. I am not aware of documentation on this other than looking deeply into the SDK.

You might want to check the code in
https://rsjazz.wordpress.com/2015/02/27/a-rtc-workitem-command-line-version-2-2/
Some data is also here, e.g. how to use Locations to create URI's
https://rsjazz.wordpress.com/2013/11/06/creating-clm-links-with-back-link/

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
× 457

Question asked: Jun 09 '15, 4:08 a.m.

Question was seen: 3,065 times

Last updated: Jun 09 '15, 5:33 a.m.

Confirmation Cancel Confirm