How to follow links from DM to DNG


In this article I describe how to generate a document with RPE that contains DM resources and their linked DNG requirements. While the example uses DNG as a target the technique is applicable to other CLM sources or even DOORS 9 with slight changes.

Credit: thanks to Kevin Cornell for his excellent DM Reporting Tutorial .

How it works

Unlike other Rational data sources links are not stored in the representation of a DM resource. This means that if you request the Reportable REST representation of a Package there will be no links inside it. The links are stored separately and access via the the “collaboration/links” Reportable REST URI.

So in order to build a document that contains DM resources and linked requirements you have to perform these 3 steps:

  1. retrieve the DM resource.
  2. retrieve the links for the DM resource
  3. access the linked artifacts

The anatomy of the template reflects these 3 steps:

DM_Links

I will skip step 1 and describe step 2 and 3

#2 Retrieve the links for a DM resource

The links for a DM resource are retrieved from the the collaboration/Link service. The dmResourceID and the dmContextID properties are available in the resource you’ve got at step 1.

https://server:port/dm/reporting/collaboration/Link?referencingId=<dmResourceID>&rmps.context=<dmContextID>

#3 Access the linked artifacts

Now that you have the link href all you need to do is access the information. Assuming all the links are for DNG text artifacts all you need is to convert the OSLC URL stored in DM to a Reportable REST form using a script like this and then access the DNG data through a Dynamic Data Source.

href.replace("resources/","publish/text?resourceURI=")

Reusing the template

The template is available on the Modelling Templates Page of the RPE DevWorks Wiki and is provided also as a reusable snippet. See the attachments section for:

  • DM Links for Package Diagrams Example
  • DM Links Snippet

Once imported in your template you connect your code to the snippet by adding code to set the baseURL, dmResourceID and dmContextID in the “add code here” Java Script block.

Author: Dragos Cojocari

Architect for Rational Publishing Engine

Leave a comment