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

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 :)

0 votes

Comments

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.

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.

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 ?

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.
 



3 answers

Permanent link
If you use the Java api, you can determine the endpoint type without any issue

0 votes


Permanent link
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
analyzeReference()

0 votes

Comments

I disagree.. we did this before, maybe three lines of code..

Please share then Sam.


Permanent link
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);
        }
       

0 votes

Comments

Pretty much my code I refer to above. The trick starts after the trivial lines, where you have to figure the URI and resolve the work item to be sure, which is three times as much code.

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
× 1,220

Question asked: Apr 04 '16, 1:08 a.m.

Question was seen: 2,851 times

Last updated: Apr 04 '16, 10:18 a.m.

Confirmation Cancel Confirm