It's all about the answers!

Ask a question

How to add Resources to DOORS modules?


Thomas Noack (60215) | asked Mar 18 '15, 3:29 p.m.
Hello,

I am currently trying to migrate System Requirement Specification (SRS) templates and their methods from DOORS Classic to DOORS Next. Therefore, I’m trying to implement a SRS-Module tailoring. The goal is to compose SRS modules from several mini-templates (which can exist multiple times in one SRS). Each mini template has several (sub)heading, example and working instruction artifacts.

I am using DOORS Next Generation 5.0.1 (Build-ID RMS5.0.1-I20140805_2017). Furthermore, I am using Eclipse Lyo OSLC4J 2.1.0.

I understand, that
- OSLC RmSpecificationV2 describes Requirement and RequirementCollection Resources
- RequirementCollection corresponds to a DNG collection (rather a set than a list)

I experienced (see example below), that
- DNG modules can be retrieved by Lyo as a RequirementCollection
- DNG modules can be updated if no resources have been added by "addUses(URI pURI)“ (see line "instanceModule.addUses(new URI(duplURL));“)
- DNG modules can be created (converted by client.createResource()) as a new RequirementCollection (i.e. DOORS collection)
    - Interestingly, my DNG version shows the newly added resources
    - But it is not showing the previously existing resources (more exactly it shows their existence but do not actually displays them, see screenshots below)

My question is, if there exists any possibility to add resources to existing modules (i.e. sorted lists).

Best regards from Berlin (Germany)
-- Thomas Noack

############# Example code #############

##### Step 1. Get the already existing template and instance modules #####
ClientResponse response = client.getResource(„path to module", OslcMediaType.APPLICATION_RDF_XML);
RequirementCollection templateModule = response.getEntity(RequirementCollection.class);

response = client.getResource(„path to module", OslcMediaType.APPLICATION_RDF_XML);
RequirementCollection instanceModule = response.getEntity(RequirementCollection.class);
String instanceEtag = response.getHeaders().getFirst(OSLCConstants.ETAG);

##### Step 2. Get the artifacts from the template module, duplicate them an add them to the instance module #####
URI[] uriL = templateModule.getUses();
for(URI uri : uriL) {
    response = client.getResource(uri.toString() , OslcMediaType.APPLICATION_RDF_XML);
    Requirement r = response.getEntity(Requirement.class);

    Requirement duplR = new Requirement();
    duplR.setInstanceShape(r.getInstanceShape());
    duplR.setTitle("It's really new: " + r.getTitle());
    org.w3c.dom.Element obj = RmUtil.convertStringToHTML(duplR.getTitle());
    duplR.getExtendedProperties().put(RmConstants.PROPERTY_PRIMARY_TEXTobj);

    ClientResponse creationResponse = client.createResource(requirementFactoryduplR, OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XML);
    String duplURL = creationResponse.getHeaders().getFirst(HttpHeaders.LOCATION);
    creationResponse.consumeContent();

    instanceModule.addUses(new URI(duplURL)); // uncommenting this leads to success (i.e. status code 200)
}

##### Step 3. Update instance module - RESULT: Update - Oh NO: 400 - Bad Request #####
response = client.updateResource(instanceURLinstanceModule, OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XMLinstanceEtag); 
int statusCode = response.getStatusCode();
String statusMsg = response.getMessage();
response.consumeContent();

if(statusCode == HttpStatus.SC_OK) {
    System.out.println("Update - Oh YEAH: " + statusCode + " - " + statusMsg);
else {
    System.out.println("Update - Oh NO: " + statusCode + " - " + statusMsg);
}

##### Step 4. Create new instance module - RESULT: Create - Oh YEAH: 201 - Created #####
response = client.createResource(requirementFactoryinstanceModule, OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XML);
statusCode = response.getStatusCode();
statusMsg = response.getMessage();
response.consumeContent();

if(statusCode == HttpStatus.SC_CREATED) {
    System.out.println("Create - Oh YEAH: " + statusCode + " - " + statusMsg);
else {
    System.out.println("Create - Oh NO: " + statusCode + " - " + statusMsg);
}

##### Screenshot after step 4 #####

Screenshot 1: DNG says that 20 of 23 artifacts exist but actually nothing is displayed (page 1/2)
Reputation <= 60. Textual description: On the first screenshot DNG is in module view and the created collection is displayed on page 1/2. It's content is blank but on the bottom it says 20 of 23 artifacts are displayed.

Screenshot 2: DNG only displays the newly added artifacts (page 2/2)
Reputation <= 60. Textual description: On the second screenshot DNG shows the same module but page 2/2. There, the newly added artifacts are displays. DNG says, that 3 of 23 artifacts are displayed.

One answer



permanent link
Thomas Noack (60215) | answered Mar 26 '15, 8:18 p.m.
edited Mar 26 '15, 8:19 p.m.
So, I found the answer with the help of the lyo-dev mailing list: "modules are exposed as read only collections". Since Lyo does implement the OSLC RM specification, it does not support DNG modules.

Now, I will implement the tailoring by using the DNG Javascript API. The new API release provides the functions I need (i.e. CreateArtifact).

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.