[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lyo-dev] How to add Resources to DOORS modules?

Hello,

my name is Thomas and I am a Requirements and Test Engineering methodologist and DOORS DXL and DNG OSLC programmer. 

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)

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_TEXT, obj);


    ClientResponse creationResponse = client.createResource(requirementFactory, duplR, 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(instanceURL, instanceModule, OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XML, instanceEtag); 
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(requirementFactory, instanceModule, 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)
Screenshot 2: DNG only displays the newly added artifacts (page 2/2)

PNG image

PNG image