Links created through server API cause constant "Refresh to get..." in Web UI
Hi everyone, I've got the following problem using the server API for RTC 6.0.6.
I've written an IOperationParticipant which creates work items if certain preconditions are met.
Those new work items should be linked to the work item that causes the call to the operation participant via the "contributes to" link type (constant WorkItemLinkTypes.CONTRIBUTES_TO_WORK_ITEM).
The following is the essence of my code that does the linking, adapted from code found here in the forum and Ralph Schoon's Blog (and again stripped down to the essence for posting here):
// Create references // Create the link // Save the link
It works well and expected for all link types, except for the one that I need: WorkItemLinkTypes.CONTRIBUTES_TO_WORK_ITEM.
When trying to create a Contributes To / Tracks type link through above code, linking will work, but the work item that is the second parameter in the createLink(...) call will always show the dirty workitem banner in the Web UI ("Refresh to get the latest updates") as soon as the browser loses and regains focus, or the user changes the tab.
Again, this doesn't happen when using the same code, but WorkItemLinkTypes.PARENT_WORK_ITEM instead of WorkItemLinkTypes.CONTRIBUTES_TO_WORK_ITEM.
Changing above from effectively
to
makes the problem appear in the parent work item instead of the child work item.
Can anyone please help me out?
|
Accepted answer
Thank you for your reply, Ralph. Re-reading the links provided, and further following links to enhancement requests in your blog finally gave me a working solution.
I'm sure others run into the same issues often, so I'm summarizing the key points that led me to the solution - they may be obvious for some, for me they were not:
What I had tried to "get there":
Ralph Schoon selected this answer as the correct answer
Comments I think you should not have to create the back link. But I have not retried my code for some time and I am aware of some problems with backlinks when linking between RTC and other configuration enabled applications.
Anyway, thanks for the detailed response!
|
2 other answers
Ralph Schoon (63.6k●3●36●46)
| answered Nov 28 '18, 10:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Nov 28 '18, 11:06 a.m. I think the issue is createReferenceToItem
Different link types need to be treated differently. Tracks/contributes to is a CLM link type and does not link workitemhandles but URIs that you have to store.
You want to use code similar to:
IWorkItem targetItem = (IWorkItem) iterator.next(); ILinkType tracksLinkType= ILinkTypeRegistry.INSTANCE.getLinkType(WorkItemLinkTypes.TRACKS_WORK_ITEM); sourceReferences.add(tracksLinkType.getTargetEndPointDescriptor(), IReferenceFactory.INSTANCE.createReferenceFromURI(Location.namedLocation(targetItem, getPublicRepositoryURL()).toAbsoluteUri()));
The code above is from a follow up action I wrote that does what you try to do. I had the same issues, until I figured from looking at the link ends that the data created with the tool looked different than what I created. Note the code above uses some older API that you have already replaced. This should work with your code as well. The key here is the createReferenceFromURI and creating the location URI: Location.namedLocation(targetItem, getPublicRepositoryURL()).toAbsoluteUri()
IReferenceFactory.INSTANCE.createReferenceFromURI(Location.namedLocation(targetItem, getPublicRepositoryURL()).toAbsoluteUri()) Comments 1
Ralph Schoon
commented Nov 28 '18, 10:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
[moved to answer] |
// The parent work item that triggered the IOperationParticipant |
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
A more readable version of above code, if I change it above, it gets flagged as spam for whatever reason.