It's all about the answers!

Ask a question

DNG 6.0.2: Reading Module requirement using OSLC


Naveen Tyagi (1876122) | asked Feb 23 '17, 2:01 a.m.

 Hi All ,
I tried doing some operations[read/delete/update/create artifacts in module] on DNG module using OSLC/Lyo but didn't make any progress. Is  it really not possible or am i missing something ?


Accepted answer


permanent link
Chintan Pania (261) | answered Feb 23 '17, 2:54 a.m.

Hello Naveen,

When you are getting the result on QueryResult, get the data in RequirementCollection class rather than Requirement  class. for eg.,

ClientResponse resp = Client.getResource(uri,OslcMediaType.APPLICATION_RDF_XML);

RequirementCollection module = resp.getEntity(RequirementCollection.class);

Regards,

Chintan Pania

Naveen Tyagi selected this answer as the correct answer

Comments
Naveen Tyagi commented Feb 23 '17, 4:11 a.m.

Hi Chintan,
Thanks for you response!!!
For collection i have already implemented all the operations but  but not able to do same for Module like list of requirements in a module. 


Naveen Tyagi commented Feb 23 '17, 5:49 a.m.

I have tried this few times before and was able to get the all artifacts inside a folder: requirement, Collection[Requirements inside] module url but not requirements inside it. This time i tested same code again  and collection code working fine for module as well. God knows what is happening in this world. Thanks :)

One other answer



permanent link
Chintan Pania (261) | answered Feb 23 '17, 6:02 a.m.

 Try this snippet,

ClientResponse resp = Client.getResource(uri,
OslcMediaType.APPLICATION_RDF_XML);
RequirementCollection modulereq = resp
.getEntity(RequirementCollection.class);
for (URI reqUri : modulereq.getUses()) {
        ClientResponse reqres = AuthClient.getResource(
reqUri.toString(),
OslcMediaType.APPLICATION_RDF_XML);

Requirement Req = reqres.getEntity(Requirement.class); // This will get all requirements under RequirementCollection/Module
}



Comments
Naveen Tyagi commented Mar 02 '17, 7:08 a.m. | edited Mar 02 '17, 7:08 a.m.

 I have implemented the same but i think i was missing something. Thanks 

Your answer


Register or to post your answer.