Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Getting the resourceURI for a DNG module via the RM API

 Is there a way to retrieve a RM module's resourceURI via the RM.Data.Attributes (for example) interface?  I've looked through the API documentation and have not found a way yet.  In DNG, the value I'm looking for is in dataSources.artifact.itemId


It would be nice if I could retrieve this via a plugin within RM.

Thanks,
Tony

0 votes



One answer

Permanent link

 OK.  Figured it out with some help from some borrowed code. from Andrew Lloyd's post on Jan 21, 2015...


Andrew Lloyd (5346| asked Jan 21 '15, 1:50 a.m. 
edited Jan 22 '15, 10:27 p.m.

Here's his code with the needed mod to post the resourceURI (refer to his post for the rest of the plugin (i.e., the xml part))
$(function() {        
    RM.Event.subscribe(RM.Event.ARTIFACT_SELECTED, function(selected) { 
        if (selected.length == 1) { 
            selectedArtifact = selected[0]; 

            RM.Data.getAttributes(selectedArtifact, [RM.Data.Attributes.CONTAINING_MODULE], function(attrResult) { 
                if (attrResult.code != RM.OperationResult.OPERATION_OK) { 
                    alert('get containing module failed in getContainingModule'); 
                    return; 
                } else { 
                    var module = attrResult.data[0].values[RM.Data.Attributes.CONTAINING_MODULE]; 


                    RM.Data.getAttributes(module, function(result) { 
                        if (result.code != RM.OperationResult.OPERATION_OK) 
                        { 
                            alert('get attributes of module failed in getContainingModule'); 
                            return; 
                        } 
                        var moduleAttributes = result.data[0]; 

                        $('#descript').val(moduleAttributes.values[RM.Data.Attributes.DESCRIPTION]); 
                        $('#identity').val(moduleAttributes.values[RM.Data.Attributes.IDENTIFIER]); 
                        $('#moduleName').val(moduleAttributes.values[RM.Data.Attributes.NAME]);
var uri                 = module.toUri();
var uriPieces           = uri.split('/');
var len = uriPieces.length;

                        $('#info').val(uriPieces[len - 1]);      // this val posts to a fourth box in the plugin.
                    }); 
                } 
            }); 
        } else { 
            $('#descript').val(''); 
            $('#identity').val('N/A'); 
            $('#moduleName').val('Select a single artifact.'); 
        } 
    }); 
}); 

0 votes

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: May 23 '19, 8:21 a.m.

Question was seen: 2,072 times

Last updated: May 24 '19, 8:55 a.m.

Confirmation Cancel Confirm