Creating Tracks links using the Java API
Hi,
I am using the following code to create Tracks links between workitems of the same project area and repository.
ILink newLink = rtcDataAccessProvider.getLinkManager().createLink(this.linkTypeToCreate, srcItemRef, tgItemRef);
rtcDataAccessProvider.getLinkManager().saveLink(newLink, monitor);
If I set linkTypeToCreate to WorkItemLinkTypes.CONTRIBUTES_TO_WORK_ITEM the link is created but shown under another (second) "Tracks" element in the Eclipse workm item editor.
Therefore I am now using WorkItemLinkTypes.TRACKS_WORK_ITEM.
Am I doing sth wrong or is this an undocumented feature of the RTC API?
2 answers
Link creation is a can of worms. The problem is understanding the correct way to create the ends. Also see: https://rsjazz.wordpress.com/2013/11/06/creating-clm-links-with-back-link/
This code works for me - note how the location is created:
If you fail to create the Location type it needs, you have trouble deleting the references. Also note the additional save parameter to create back links.
Note Internal location is just a class to hold the reference and the endpoint.
This code works for me - note how the location is created:
Location location = Location.namedLocation(workItem, ((ITeamRepository) workItem.getOrigin()) .publicUriRoot()); found.add(new InternalReference(endpoint, IReferenceFactory.INSTANCE .createReferenceFromURI(location .toAbsoluteUri())));
If you fail to create the Location type it needs, you have trouble deleting the references. Also note the additional save parameter to create back links.
Note Internal location is just a class to hold the reference and the endpoint.
Comments
showing 5 of 6
show 1 more comments
Comments
Marko Tomljenovic
Feb 07 '15, 5:22 p.m.Geoffrey Clemm
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Feb 07 '15, 5:36 p.m.Marko Tomljenovic
Feb 08 '15, 3:26 p.m.