Overview:
‘Quick link’ feature in Enterprise Architect’s makes connector creation quicker and easier. Though quick linker simplifies the concept of creating connectors between artifacts (or) elements, the process of defining it would really consume a huge amount of time and manual efforts sometimes lead to errors. Though quick linker simplifies the concept of creating connectors between artifacts (or) elements, the process of defining it would really consume a huge amount of time and manual efforts sometimes lead to errors.
To overcome this we have created a custom script. This allows us to generate the quick linker definition quicker & easier than ever before. Please follow the below steps to create your quick linker definition with ease.
Pre-requisite:
- Custom MDG Technology. Please refer to how to define a custom MDG in this link
https://sparxsystems.in/how-to-define-mdg-technologies-in-enterprise-architect/ - Must have a diagram (Metamodel / Blueprint) with connectors between artifacts which are required as quick links.
Steps to follow:
- Create a diagram group in the scripting section
- Create a J-Script below the newly create diagram group. Copy and Paste the code snippet given below
!INC Local Scripts.EAConstants-JScript
/*
* This code has been included in the default Diagram Script template.
* If you wish to modify this template, it is located in the Config\Script Templates
* directory of your EA install path.
*
* Script Name: Generate Quick Linker Definition
* Author: Nabil Saleem – Sparx Systems India
* Purpose: Generate the quick linker definition from metamodel and to reuse in MDG definition
* Date: 12/07/2018
*/
/*
* Diagram Script main function
*/
function OnDiagramScript(diaID)
{
// Get a reference to the current diagram
var currentDiagram as EA.Diagram;
currentDiagram = Repository.GetCurrentDiagram();
Session.Output(“//Source Element Type\tSource ST filter\tTarget Element Type\tTarget ST Filter\tDiagram Filter\tNew Element Type\tNew Element ST\tNew Link Type\tNew Link ST\tNew Link Direction\tNew Link Caption\tNew Link & Element Caption\tCreate Link\tCreate Element\tDisallow Self connector\tExclusive to ST Filter + No inherit from metatype\tMenu Group\tComplexity Level\tTarget Must Be Parent\tEmbed element\tPreceeds Separator LEAF\tPreceeds Separator GROUP\tDUMMZ COLUMN”);
if ( currentDiagram != null )
{
for(var i=0; i<currentDiagram.DiagramLinks.Count; i++)
{
var dialinks as EA.DiagramLink;
var curCon as EA.Connector;
dialinks = currentDiagram.DiagramLinks.GetAt(i);
curCon = Repository.GetConnectorByID(dialinks.ConnectorID);
var SourceElem as EA.Element;
SourceElem = Repository.GetElementByID(curCon.ClientID);
var TargetElem as EA.Element;
TargetElem = Repository.GetElementByID(curCon.SupplierID);
var ConcType = “”;
if(curCon.Type==”Realisation”)
ConcType = “Realization”;
else
ConcType = curCon.Type;
Session.Output(SourceElem.Type + “\t”+ SourceElem.Stereotype + “\t” + TargetElem.Type + “\t” + TargetElem.Stereotype + “\t” + “\t” + TargetElem.Type + “\t” + TargetElem.Stereotype + “\t” + ConcType + “\t” + curCon.Stereotype + “\t” + ‘to’ + “\t” + “<Connector Caption>” + “\t” + “<Element Caption>” + “\t” + “TRUE” + “\t” + “TRUE” + “\t” + “FALSE” + “\t” + “TRUE” + “\t” + “\t” + “0”);
//Session.Output(TargetElem.Type + “\t” + TargetElem.Stereotype + “\t” + SourceElem.Type + “\t”+ SourceElem.Stereotype + “\t” + “\t” + SourceElem.Type + “\t”+ SourceElem.Stereotype + “\t” + ConcType + “\t” + curCon.Stereotype + “\t” + ‘from’ + “\t” + “<Connector Caption>” + “\t” + “<Element Caption>” + “\t” + “TRUE” + “\t” + “TRUE” + “\t” + “FALSE” + “\t” + “TRUE” + “\t” + “\t” + “0”);
}
Session.Output(“Done”);
}
else
{
Session.Prompt( “This script requires a diagram to be visible.”, promptOK)
}
}
OnDiagramScript();
- Now open the diagram which has the connectors and artifacts
- Right – Click on the diagram. Select Script|New Script from Context Menu.
- Now open the system output screen
- Right – Click on the system output screen. Then click “Copy All to Clipboard”
- Paste the clipboard data into the excel file
- Replace the cell values of “New Link Caption” – Column K & “New Link & Element Caption” – Column L.
- Now save the file as CSV.
- Now copy and paste the CSV data in MDG quick link artifact and generate custom MDG with quick links
Note: This feature is only available in Enterprise Architect 13.5.
Further Information
Please contact us or write an email to info@sparxsystems.in to have a live demo of the new EA 16 features and capabilities.