It's all about the answers!

Ask a question

How to create a user defined attribute in RDNG RM using OSLC API?


Sandesh Iruvatharaya (1314) | asked Apr 01 '16, 5:17 a.m.
 Hello,

I am writing a Java application to export the requirements captured in the excel sheet into RDNG using the OSLC APIs. I've managed to create new requirements in a Project and fill the data for the basic attributes. 
My problem is, say there is a user defined attribute/column in excel called EmpID of type integer. How do I create the attribute as part of these requirements? 
Based on my understanding, I will have to use Requirement.setExtendedProperties() API. Please correct me if I am wrong. But I am not able to find an example or detailed explanation on how to achieve this.
Below is the part of the code which I have executed successfully.

Requirement myRequirement = new Requirement();
myRequirement.setInstanceShape(featureInstanceShape.getAbout());
myRequirement.setTitle("Requirement 01");
String primaryText = null;
primaryText = "This requirement is created to test";
org.w3c.dom.Element obj = RmUtil.convertStringToHTML(primaryText);
myRequirement.getExtendedProperties().put(RmConstants.PROPERTY_PRIMARY_TEXT, obj);
myRequirement.setDescription("Created Through Java Client");
myRequirement.addElaboratedBy(new Link(new URI("http://www.google.com"), "Link example"));
ClientResponse creationResponse = client.createResource(requirementFactory, myRequirement,
OslcMediaType.APPLICATION_RDF_XML,
OslcMediaType.APPLICATION_RDF_XML);

Now, before I send this requirement to the server, I want to create EmpID attribute and fill it with the data.
Explanation with example or link to an example code will really help. 
Thank you.

2 answers



permanent link
Adrian Haw (2741041) | answered Apr 04 '16, 10:31 a.m.
edited Apr 04 '16, 10:31 a.m.
The ability to create user-defined types and attributes would be a very useful addition to the client extension API.

permanent link
Gabriel Ruelas (1.1k13) | answered Apr 01 '16, 9:48 a.m.
The OSLC spec does not specify a way to modify project structure. If the attribute does not exists an OSLC consdumer will not be able to update it.

Comments
Sandesh Iruvatharaya commented Apr 03 '16, 11:48 p.m.

 Thank you very much. At least now I clearly know that it is not possible, I can look for alternative solutions to achieve this. Cheers!!!

Your answer


Register or 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.