It's all about the answers!

Ask a question

How to add "SatisfiedBy/satisfies" link in DNG workitem through OSLC API?


Nilesh Patil (1733650) | asked Apr 09 '15, 10:51 a.m.
Hi All,

I am working on task where I have to update DNG artifact with link("SatisfiedBy/satisfies"). I am using OSLG4j(OSLC client) for developing my stand alone application. I am able to add link of type "SpecifiedBy/Specifies" in DNG artifact through my code, but not able to add "SatisfiedBy/satisfies" link.

Sample code

Requirement req = response.getEntity(Requirement.class);
String etag = response.getHeaders().getFirst(OSLCConstants.ETAG);
ClientResponse updateResponse = null;
                        req.addSatisfiedBy(new Link(new URI(artifact.getKey()), artifact.getValue()));
                        updateResponse = client.updateResource(resultsUrl, req, OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XML, etag);
                        if(updateResponse.getStatusCode() ==HttpStatus.SC_OK) {
                            System.out.println("Requirement updated successfully with requirement : " + artifact.getValue());
                        } else {
                            System.out.println("Issue while updating requirement..............." +  artifact.getValue());
                        }

When I run this code I am getting response 200 but unable to see link in Doors artifact. Is there any linitation on adding by OSLC rest api?
        
          
Could you please let me know how to achieve same?

Thank you in advance

Comments
Vaibhav S commented May 17 '21, 1:38 p.m.

Hi nitesh, 


did you find an answer to this problem.

Please let me know, i am stuck at same issue.

Thanks
vaibhav 

One answer



permanent link
Donald Nong (14.5k414) | answered Apr 09 '15, 11:34 p.m.
No such problem in my RDNG 5.0.2 environment. It should be quite simple as to add a <rm_property> attribute to the artifact presentation and update it with a PUT operation. I suggest you double check the instance shape of the artifact and make sure you are using the correct UUID for the Satisfaction link type.

Comments
Nilesh Patil commented Apr 13 '15, 12:04 p.m. | edited Apr 13 '15, 12:26 p.m.

Hi I am trying to create links in artifact trough OSLC api, but seems no luck, Unable to see satisfies link in artifact though I am getting response as 200 for update operation,

However I am able to add Specifies link through api. I am using below code to create links.
Requirement req = response.getEntity(Requirement.class);
req.addSatisfies(new Link(new URI(XXX), XXX)); // req.addSatisfies(new Link(new URI(XXX), XXX));(works prefect)
response = client.updateResource(resultsUrl, req, OslcMediaType.APPLICATION_RDF_XML,  OslcMediaType.APPLICATION_RDF_XML, etag);

This is how I have configured links in Project management properties(Note this are manually created links of type Satisfies /Satisfied By

Satisfies    Satisfied By / Satisfies    http://open-services.net/ns/rm#satisfies   
Satisfied By    Satisfies / Satisfied By    http://open-services.net/ns/rm#satisfiedBy

Thank you in advance
  


Donald Nong commented Apr 13 '15, 11:55 p.m. | edited Apr 13 '15, 11:56 p.m.

 Have you checked the instance shape of the artifact as I suggested? GET an RDF+XML presentation of the artifact first, and take note of the <oslc:instanceShape> attribute. Then GET the instance shape, and you should see something like this

<oslc:Property>
<oslc:name>_05YjMYPsEeSfUbpncKGSsw</oslc:name>
<oslc:propertyDefinition rdf:resource="https://clm502/rm/types/_05YjMYPsEeSfUbpncKGSsw" />
<oslc:representation rdf:resource="http://open-services.net/ns/core#Reference" />
<oslc:valueType rdf:resource="http://open-services.net/ns/core#Resource" />
<dc:description rdf:parseType="Literal" />
<oslc:occurs rdf:resource="http://open-services.net/ns/core#Zero-or-many" />
<dc:title rdf:parseType="Literal">Satisfaction</dc:title>;
</oslc:Property>

Your answer


Register or to post your answer.