Products

Further customization of the Polarion connector for Simulink.

Several weeks ago I discussed some of the new features we added to the latest release of the Polarion connector for Simulink. In that new release, we allowed users to export and link Simulink artifacts to different Polarion servers and projects “on the fly”. This allowed users to maintain a single Simulink model and link or export those artifacts to multiple Polarion projects. Very handy indeed!

For some of the more astute amongst you, I dropped a small “easter egg” in the last blog post. It was in Figure 5, the last screenshot of the article.

screen4.JPG

If you notice, you will see in the description field of the Simulink link editor, not only are we showing the Polarion work-item ID, but also the title of the ID. By default, the connector will only show the ID. This was intentionally done because there are times when you might not want to publish the full title of the work-item. Perhaps the information has security classification, and you don’t want this information published outside of Polarion.

However, in the case where you do … how can you change this setting in the connector to publish the work-item title? Well … its back to the “extension.m” configuration file we discussed in the last blog post. Do you remember it? We need to make a few changes. Lets see how its done ….

If you goto the saveRequired, TargetRmiLink function, we are going to change the default setting so we update the RMI description field with the full Polarion work item-ID. Look for the comment %replace default title in the Link Editor, in the code snippet below. Add the two additional lines to your extension.m file and restart Simulink. Next time you create a link to Polarion, you will see the full title in the RMI description field! Its as easy as that.

function [saveRequired, targetRmiLink] = updatePolarionFields (rmiLink, openNewSession)
saveRequired = false;
targetRmiLink = rmiLink;

fullURL = PolarionFunctions.getURLfromRMILink(rmiLink);

% Make sure it’s really Polarion link
if regexpi(fullURL, ‘https?://.*/polarion/#/.*/workitem?id=.*’) == 1
serverURL = PolarionFunctions.getServerURL(fullURL);
if ~openNewSession || PolarionFunctions.login(serverURL)
uri = PolarionFunctions.getURI(fullURL);
keywords = extractPolarionFields(uri, serverURL);
if ~isequal(rmiLink.keywords, keywords)
% Replace default title in the Link Editor
workitem = PolarionFunctions.getWorkItemByUri(uri, serverURL);
rmiLink.description = char(sprintf(‘Polarion: %s – %s’, workitem.getId(), workitem.getTitle()));
% — end of title
rmiLink.keywords = keywords;
saveRequired = true;
targetRmiLink = rmiLink;
fprintf(‘Result keywords: %sn’,keywords);
end
end
if openNewSession
PolarionFunctions.logout(serverURL);
end
end
end

In a earlier blog article I also explained how we now write to the RMI user tag field. This is useful for publishing certain custom work-item fields to Simulink. The default settings actually writes the Polarion work item title to the user tag. For the reasons discussed earlier, you may decide you don’t want to write the title here. If thats the case, simply remove the “title” from this part of the code in the extensions file.

        function fieldNames = polarionWIFieldList
fieldNames = {‘id’; ‘title’; ‘type’; ‘severity’};
end

For more information on publishing to the user tag field, take a look at more earlier blog post here

Well, I hope you’ve enjoyed these series of short articles that talk about customizing the Polarion connector for Simulink. I’ll be back again another time with some more tips and tricks for you.

You can download the latest version of the Simulink connector for Polarion here from the extension portal. If you’re new to Polarion, why not try it out for yourself with a free evaluation? For more information, please visit https://polarion.plm.automation.siemens.com/products/alm/demo


 


Happy customizing!


 


AW

Adrian Whitfield

Comments

One thought about “Further customization of the Polarion connector for Simulink.
  • Hello Team, are there any updates regarding this connector? A Customer mentioned yesterday that this connector uses some old functionality of Mathlab Simulink and the Simulink consultant suggested them to use the reqif format. Is this true?

Leave a Reply

This article first appeared on the Siemens Digital Industries Software blog at https://blogs.stage.sw.siemens.com/polarion/further-customization-of-the-polarion-connector-for-simulink/