How to add "SatisfiedBy/satisfies" link in DNG workitem through OSLC API?
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
One answer
Comments
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
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>
Comments
Vaibhav S
May 17 '21, 1:38 p.m.Hi nitesh,