How to detect if some link belongs to RTC work items ?
Hello All,
Can we detect if some link belongs to RTC work item ?
For E.g. say in one of my work item's description I have mentioned 2 links, one contains a link to another work item in RTC and one more say www.google.com.
I want to detect that one work item link which belongs to RTC and remove www.google.com from this result.
Any hints how do I achieve this..?
Thanks for any help :)
Can we detect if some link belongs to RTC work item ?
For E.g. say in one of my work item's description I have mentioned 2 links, one contains a link to another work item in RTC and one more say www.google.com.
I want to detect that one work item link which belongs to RTC and remove www.google.com from this result.
Any hints how do I achieve this..?
Thanks for any help :)
3 answers
It ain't trivial Sam. As mentioned above there are two types of links. One is basically an item reference and one is an URI reference. these have to be dealt with in different ways. Here code that worked for me:
https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/
See
https://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/
See
analyzeReference()
see
private static void analyzeReferences(IWorkItemReferences iReferences)
in https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes
tells you all the reference types of all the links in a workitem.
more than 3 lines of code, but the decision is easy, in his case wanting to remove the google.com uri reference
if (iReference.isURIReference())
{
analyzeReferenceTarget(iReference);
}
private static void analyzeReferences(IWorkItemReferences iReferences)
in https://jazz.net/forum/questions/94776/assertionfailedexception-problem-with-getting-the-values-of-attributes
tells you all the reference types of all the links in a workitem.
more than 3 lines of code, but the decision is easy, in his case wanting to remove the google.com uri reference
if (iReference.isURIReference())
{
analyzeReferenceTarget(iReference);
}
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Apr 04 '16, 2:47 a.m.I don't know. You could try to use the RTC CM OSLC interface to try to access the resource and check the data you get back. I would assume there are some hints that you could use to distinguish between a work item/OSLC resource and just an arbitrary URL.
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Apr 04 '16, 5:34 a.m.Another way might be the format of the link. There are multiple formats available as far as I know. Below publicURIRoot looks like https://server:7443/ccm
One looks like: publicURIRoot/resource/itemName/com.ibm.team.workitem.WorkItem/2 and the last part is the work item ID.
Another one looks like I am publicURIRoot/resource/itemOid/com.ibm.team.workitem.WorkItem/_bV3EMPA2EeWIVM8BVm4oIg where the last part is the UUID of the work item.
Arshad Adavani
Apr 04 '16, 7:25 a.m.Hi Ralph,
Thanks for the response.
I have one more question. We have short forms to specify a link in RTC.
For E.g. say in summary field I write as Work Item 123, then it becomes a link to work item 123 but when I fetch this summary using getHTMLSummary(), it is plain text. How do I fetch this link in the background ?
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Apr 04 '16, 7:38 a.m.There is a computation behind the work item editor and work item save, where the pattern e.g. defect 123 is detected and a potential link to a work item is computed.
The link in the summary (the summary is an XMLText attribute) is created as HTML link tag and the work item is also added to as a mentions link.