Quick Link Definition Simplified

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 consumes 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 ease.

Pre-requisite:

  • Custom MDG Technology. Please refer how to define a custom MDG here
  • Must have a diagram (Metamodel / Blueprint) with connectors between artifacts which are required as quick links.

Steps to follow:

  • Create a diagram group in 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 from 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: Sparx Systems India
* Purpose: Generate 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” + “” + “\t” + “” + “\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” + “” + “\t” + “” + “\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 system output screen. Then Click “Copy All to Clipboard”
  • Paste the clipboard data in the excel file
  • Replace the cell values of “New Link Caption” – Column K & “New Link &amp; 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

Leave a Reply

Your email address will not be published. Required fields are marked *