It's all about the answers!

Ask a question

Insert 'Link to' to existing requirements artifact


Tim Reimer (11) | asked Jan 31 '19, 4:29 a.m.
edited Jan 31 '19, 4:44 a.m. by Ralph Schoon (57.1k23642)
I've been working with OSLC and the WorkitemsApi lately and successfully managed to add comments and links to workitems just by executing the Java application. Here a code snippet how this looks like in the WorkitemsApi:

  @Override
  public synchronized RtcComment addComment(long id, String text) throws IOException {
    loginIfNeeded();
    return transport.post(
        "/oslc/workitems/" + id + "/rtc_cm:comments",
        RtcComment.class,
        Transport.APP_JSON,
        new BasicNameValuePair("dc:description", text));
  }

I am looking for a similar way to also insert links, for example a 'Link to', into an existing requirement. I have found ways to do this after creating an artifact, because then you have the correct identifier of the artifact. But what if I only have the human readable ID like 12345, or the url to the artifact?

Actual question:
How do I insert a link into a requirement by a simple REST query in Java?

Comments
Tim Reimer commented Jan 31 '19, 4:59 a.m.

I mean like a http POST or something similar

2 answers



permanent link
Ralph Schoon (57.1k23642) | answered Jan 31 '19, 4:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 You can not insert anything into anything using a REST Query. 


Comments
Tim Reimer commented Jan 31 '19, 4:51 a.m.

I believe that is how jazz handles things though. Of course I'm open to other ways as well, as long as it works.


Ralph Schoon commented Jan 31 '19, 5:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

A QUERY is a means to find a list of something. 


permanent link
Ralph Schoon (57.1k23642) | answered Jan 31 '19, 5:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 As far as my knowledge goes and that is not very far, the RM application is OSLC compliant. 


In OSLC, you would GET the URI of the element to get the object representation in the response body. 
  • You can then modify said representation you create from the response body. 
    • You can add something like a link 
    • You can remove something like a link
  • You send a PUT back with the OSLC headers and the request body created from the representation
Please see http://www.oasis-oslc.org/ for the OSLC specification.


Comments
Ralph Schoon commented Jan 31 '19, 5:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The same applies to the RTC Work Item REST/OSLC API. 


Tim Reimer commented Jan 31 '19, 5:30 a.m.

Yes that is also what I know. But how in detail would this look like?


Ralph Schoon commented Jan 31 '19, 5:40 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Here a hint: https://jazz.net/library/article/635 


I have provide another one, look at OSLC. 
There are also examples here in the forum. 
We have consultants you can hire for this. 


Ralph Schoon commented Jan 31 '19, 5:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Also see https://github.com/eclipse/lyo.client and the OSLC Java examples.


Also https://jazz.net/library/article/1001 and linked information. Best I can do.

Your answer


Register or to post your answer.