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
|
One answer
OK. Figured it out with some help from some borrowed code. from Andrew Lloyd's post on Jan 21, 2015...
Andrew Lloyd (53●4●6) | 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.');
}
});
});
|
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.