It's all about the answers!

Ask a question

How Can I Write an RM Query to Fetch Module-Context Artifact URI and Artifact Base-URI at the Same Time?


Nate Decker (37814761) | asked Jul 17 '14, 11:29 a.m.

I am authoring a report in RPE that generates a Word document from a Module. The report works, but I would really like to add a particular feature.

Background:
Within RM, you can link to another artifact in the same module. You might do this if you are referencing a figure, table, or a section. When that content is exported out to Word, I'd like to convert those hyperlink references to Word cross-references. If I leave them as hyperlinks in the Word document, then if a user tries to click on that hyperlink they will be taken to their web browser to view the artifact in RM. However, if the artifact to which the link is pointing is present within the exported Word document, I would like the hyperlink to be a cross-reference to that portion of the document instead.

How I'm trying to do it:
I'm trying to do this by running a post-processing macro in Word that iterates over all of the hyperlinks in the document and looks at the GUID of the target artifact (which is included in the hyperlink). I am also trying to include the GUID of each artifact in the export out to Word (they'll be removed later for formatting purposes). Having both GUIDs will allow me to correlate them and create the cross-reference.

Problem:
Due to performance issues, our RPE report uses the "views" data source schema which is modeled after the printModuleBook report template. When fetching data from a module using this data source, the artifact GUIDs that the XML provides for each artifact is context-independent of the module. In other words, we get the GUID corresponding to the base URI rather than the module-context URI.

By contrast, any hyperlinks that are present in the text refer to the artifacts using the module-context URIs. So we have a mismatch. I can't match up the hyperlinks with the artifacts that were exported.

Question:
What I really need is some kind of REST query that will give me all of the artifacts in a module and return both their module-context URIs as well as their base URIs. That would provide a lookup table that I can use to fix the broken matchup in the views data source.

Sending a GET to the server using the Module Link URI with the OSLC 2.0 header set gives half of what I need. It returns the full list of all artifacts using the module-context URIs. It seems like there ought to be some kind of OSLC query that I could build that would give me both. Any suggestions?


Comments
Donald Nong commented Jul 17 '14, 9:41 p.m.

An HTTP header "DoorsRP-Request-Type: private" is required to expose the <rm:boundArtifact> attribute of a module artifact when you do a simple GET. But none of the reportable REST API seems to care about this header and adds this attribute in the response.


Nate Decker commented Jul 18 '14, 12:23 p.m.

I don't know how I can set an additional header in the RPE Data Source. The underlying http requests don't seem to be exposed to that level within the RPE tool. Even if I could, I'm not sure if that's going to solve my problem though. It sounds like you're saying that setting the header doesn't affect the output of the API call?

One answer



permanent link
Nate Decker (37814761) | answered Jul 18 '14, 12:27 p.m.

I think there is a work-around for this issue on the authoring side of the Module. It looks like you can retrieve the module-context-aware artifact link if you do so from within the module view. This can be done from the pencil drop-down at the left of the artifact's row. Then, when inserting a cross-reference link to the artifact, you can choose to insert a "web" link and paste in that module-context-aware link. This method is in contrast to the typical procedure which would likely be to simply create the link by referencing the target work item's identifier. Using the work item's identifier creates a link to the base-artifact.

So if I can get my users to create module-context-aware links, those links should be preserved in my output report. I think it makes sense that an artifact can have more than one link that takes you to different contexts when you follow it, but it seems like RM's default behavior should be to use the module-context-aware link when you reference an artifact by identifier from within a module.

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.