automation - sparx systems

885
Automaon Enterprise Architect User Guide Series Author: Sparx Systems Date: 26/07/2018 Version: 1.0 CREATED WITH

Upload: khangminh22

Post on 26-Mar-2023

1 views

Category:

Documents


0 download

TRANSCRIPT

Automation

Enterprise Architect

User Guide Series

Author: Sparx SystemsDate: 26/07/2018

Version: 1.0CREATED

WITH

Table of Contents

Automation 13Hybrid Scripting 16C# Example 19Java Example 22

Scripting 25Scripts Tab 30Console Tab 35Script Group Properties 39Script Editor 43Session Object 51Script Debugging 53

Enterprise Architect Object Model 56Using the Automation Interface 59Connect to the Interface 60Set References In Visual Basic 66

Examples and Tips 69Call from Enterprise Architect 73Available Resources 76

Reference 79Interface Overview 81App Object 84Enumerations 86ConstLayoutStyles 89

CreateBaselineFlag 92CreateModelType 93DocumentBreak 94DocumentPageOrientation 95DocumentType 96EAEditionTypes 97EnumRelationSetType 98ExportPackageXMIFlag 100MDGMenus 101MessageFlag 102ObjectType 104PropType 108ReloadType 109ScenarioDiagramType 110ScenarioStepType 112ScenarioTestType 113XMIType 114

Repository Package 116Author Class 117Client Class 120Collection Class 123The AddNew Function 128

Datatype Class 136EventProperties Class 141EventProperty Class 143ModelWatcher Class 145Package Class 147

ProjectIssues Class 169ProjectResource Class 173ProjectRole Class 176PropertyType Class 179Reference Class 182Repository Class 185Stereotype Class 238Task Class 242Term Class 246

Element Package 249Constraint Class 251Effort Class 254Element Class 257File Class 288Issue (Maintenance) Class 291Metric Class 295Requirement Class 298Resource Class 302Risk Class 306Scenario Class 309ScenarioExtension Class 313ScenarioStep Class 316TaggedValue Class 320Test Class 324

Element Features Package 328Attribute Class 330AttributeConstraint Class 339

AttributeTag Class 342CustomProperties Collection 346EmbeddedElements Collection 348Method Class 350MethodConstraint Class 359MethodTag Class 362Parameter Class 366ParamTag Class 371Partitions Collection 374Properties Class 376TemplateParameter Class 379Transitions Collection 382

Connector Package 384Connector Class 386ConnectorConstraint Class 399ConnectorEnd Class 402ConnectorTag Class 408RoleTag Class 412TemplateBinding Class 416

Diagram Package 420Diagram Class 421DiagramLinks Class 438DiagramObject Class 443SwimlaneDef Class 455Swimlanes Class 458Swimlane Class 461

Project Interface Package 463

Project Class 464Document Generator Interface Package 508DocumentGenerator Class 510

Mail Interface Package 522MailInterface Class 523

Simulation Package 529Simulation Class 530

Schema Composer Package 533SchemaProperty Class 534SchemaComposer Class 538SchemaProfile Class 541ModelType Class 543ModelTypeEnum Class 546SchemaType Class 547SchemaTypeEnum Class 549SchemaPropEnum Class 550SearchType Enumeration 551

Code Samples 552Open the Repository 554Iterate Through a .EAP File 556Add and Manage Packages 558Add and Manage Elements 560Add a Connector 562Add and Manage Diagrams 565Add and Delete Features 567Element Extras 569Repository Extras 577

Stereotypes 582Work With Attributes 584Work With Methods 587

Enterprise Architect Add-In Model 591The Add-In Manager 594Add-In Tasks 596Create Add-Ins 598Define Menu Items 600Deploy Add-Ins 604Tricks and Traps 608

Add-In Search 614XML Format (Search Data) 616

Add-In Events 619EA_Connect 621EA_Disconnect 623EA_GetMenuItems 624EA_GetMenuState 627EA_GetRibbonCategory 630EA_MenuClick 632EA_OnOutputItemClicked 635EA_OnOutputItemDoubleClicked 638EA_ShowHelp 641

Broadcast Events 644Schema Composer Broadcasts 647EA_GenerateFromSchema 648EA_GetProfileInfo 650EA_IsSchemaExporter 652

Add-In License Management Events 654EA_AddinLicenseValidate 655EA_AddinLicenseGetDescription 657EA_GetSharedAddinName 659

Compartment Events 662EA_QueryAvailableCompartments 663EA_GetCompartmentData 666

Context Item Events 671EA_OnContextItemChanged 672EA_OnContextItemDoubleClicked 675EA_OnNotifyContextItemModified 678

EA_FileClose 680EA_FileNew 682EA_FileOpen 684EA_OnPostCloseDiagram 686EA_OnPostInitialized 688EA_OnPostOpenDiagram 690EA_OnPostTransform 692EA_OnPreExitInstance 694EA_OnRetrieveModelTemplate 695EA_OnTabChanged 698Model Validation Broadcasts 700EA_OnInitializeUserRules 702EA_OnStartValidation 704EA_OnEndValidation 706EA_OnRunElementRule 708EA_OnRunPackageRule 710

EA_OnRunDiagramRule 712EA_OnRunConnectorRule 714EA_OnRunAttributeRule 716EA_OnRunMethodRule 718EA_OnRunParameterRule 720Model Validation Example 723

Post-New Events 734EA_OnPostNewElement 736EA_OnPostNewConnector 738EA_OnPostNewDiagram 740EA_OnPostNewDiagramObject 742EA_OnPostNewAttribute 744EA_OnPostNewMethod 746EA_OnPostNewPackage 748EA_OnPostNewGlossaryTerm 750

Pre-Deletion Events 752EA_OnPreDeleteElement 754EA_OnPreDeleteAttribute 756EA_OnPreDeleteMethod 758EA_OnPreDeleteConnector 760EA_OnPreDeleteDiagram 762EA_OnPreDeleteDiagramObject 764EA_OnPreDeletePackage 766EA_OnPreDeleteGlossaryTerm 768

Pre New-Object Events 770EA_OnPreNewElement 772EA_OnPreNewConnector 774

EA_OnPreNewDiagram 777EA_OnPreNewDiagramObject 779EA_OnPreDropFromTree 781EA_OnPreNewAttribute 783EA_OnPreNewMethod 785EA_OnPreNewPackage 787EA_OnPreNewGlossaryTerm 789

Tagged Value Broadcasts 791EA_OnAttributeTagEdit 792EA_OnConnectorTagEdit 794EA_OnElementTagEdit 796EA_OnMethodTagEdit 798

Technology Events 800EA_OnInitializeTechnologies 801EA_OnPreActivateTechnology 803EA_OnPostActivateTechnology 805EA_OnPreDeleteTechnology 807EA_OnDeleteTechnology 810EA_OnImportTechnology 813

Custom Views 816Create a Custom View 817

Add a Portal 819Custom Docked Window 821MDG Add-Ins 824MDG Events 825MDG_Build Project 827MDG_Connect 829

MDG_Disconnect 832MDG_GetConnectedPackages 834MDG_GetProperty 836MDG_Merge 839MDG_NewClass 845MDG_PostGenerate 847MDG_PostMerge 850MDG_PreGenerate 852MDG_PreMerge 854MDG_PreReverse 856MDG_RunExe 858MDG_View 860

Workflow Scripts 863Workflow Script Functions 867Functions - Validate and Control User Input 869Functions - Create a Search With User Tasks 874Filled Workflow Data Structures 875Workflow Data Structures You Fill 879Functions You Call 882

User Guide - Automation 26 July, 2018

Automation

Enterprise Architect has a formidable set of built-in featuresfor working with models, but it also provides a range ofenvironments for accessing and manipulating the contents ofa repository programmatically. This is an extremelypowerfully facility that gives you unlimited ability to queryand manipulate models, add to the Enterprise Architect userinterface, generate reports, and even create support for newmodeling languages. The Automation Interface gives youaccess to the Object Model, which is an easy to use and welldefined set of objects with properties and methods that canbe used to query and manipulate the repository and itscontents, shielding the programmer from having to know theunderlying repository data structures.

The automation interface is available from a scriptingframework built into the Enterprise Architect user interface,through external scripting environments, or through Add-Insthat can be built in a wide range of programming languages.

Facilities

Facility Description

(c) Sparx Systems 2018 Page 13 of 885

User Guide - Automation 26 July, 2018

Scripting Learn about the flexible and easy-to-usescripting capability to programmaticallyinspect and/or modify elements withinyour currently open model.

Object Model Discover the Enterprise Architect Objectmodel. Write your own custom programsthat access the information stored inEnterprise Architect.

Add-InModel

The Enterprise Architect Add-In modelhelps you build on the features providedby the Automation Interface to enableyou to extend the Enterprise Architectuser interface.

MDGAdd-Ins

MDG Add-Ins are specialized types ofAdd-Ins that have additional features andextra requirements. MDG Add-Ins arefocused on generation, synchronizationand general processes concerned withconverting models to code and code tomodels.

CodeSamples and

Reference

Access the wealth of knowledge andsamples to help you complete yourAdd-In.

(c) Sparx Systems 2018 Page 14 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 15 of 885

User Guide - Automation 26 July, 2018

Hybrid Scripting

Hybrid scripting extends the capabilities of the standardscripting environment to high level languages such as Javaand C#. Hybrid scripting provides a speed advantage overconventional scripting, and also allows script authors toleverage existing skills in popular programming languages.

Access

(c) Sparx Systems 2018 Page 16 of 885

User Guide - Automation 26 July, 2018

Ribbon Design > Package > Insert > Insert UsingModel Wizard > Application Patterns

ContextMenu

Right-click on Package | Add a Modelusing Wizard | Application Patterns

Keyboard Ctrl+Shift+M | Application Patterns

(c) Sparx Systems 2018 Page 17 of 885

User Guide - Automation 26 July, 2018

Shortcuts

Other Project Browser caption bar menu | NewModel from Pattern | Application Patterns

Features

Superior execution speed·

Enhanced interoperability·

Full Visual Execution Analyzer support·

(c) Sparx Systems 2018 Page 18 of 885

User Guide - Automation 26 July, 2018

C# Example

This sample program demonstrates how easy it is tonavigate, query and report on the current model using anyMicrosoft .NET language. This example is written in C#.

When run, it will print the names of every Package in themodel you are currently using.

Create the project

In the Project Browser, select the Package in which to createthe template and then use the ribbon or context menu todisplay the Model Wizard; select the 'Application Patterns'tab.

On the 'Application Patterns' tab, select the Microsoft C# >RepositoryInterface template. (You can choose from eitherthe 3.5 or the 4.0 framework versions.) Specify thedestination folder on the file system where the projecttemplate will be created, and click on the OK button.

Open the project

A Package structure similar to this will be created for you.

(c) Sparx Systems 2018 Page 19 of 885

User Guide - Automation 26 July, 2018

Expand the structure until you locate the RepositoryInterface n.n diagram and open it.

Overview:

This sample program demonstrates how easy it is to navigate, query and report on the current model using any Microsoft .NET language. This example is written in C#.When run, it will print the names of every Package in the model you are currently using.

Framework:The build uses the C# compiler from the Microsoft .NET framework.

Version:4.0

Note:The links on the right operate on the active Analyzer ScriptTo use these links make sure you have selected the 'Repository Interface 4.0' script.You can use the Analyzer Scripts link below to do this.

BuildBuild the project

RunRun your program

Debug the program *DebugRunAnalyzer Scripts

Program

- m_ProcessID: int = 0- Repository: EA.Repository = null

- Main(string[]): void+ PrintModel(): bool- PrintPackage(EA.Package): void+ Program(int)

Build the script

The commands on this diagram will operate on the activebuild configuration. Before executing them, double-click onthe Analyzer Scripts link and select the checkbox next to the'Repository Interface' build configuration.

(c) Sparx Systems 2018 Page 20 of 885

User Guide - Automation 26 July, 2018

Run the script

Double-click on the Run link to open the Console. TheConsole will pause after completion so you can read theoutput from the program; this output will also be sent to the'Script' tab of the System Output window. You can alter thisby changing the code.

Debug the script

Select the 'Program' Class from the Project Browser andpress Ctrl+E to open the source code.

Place a breakpoint in one of the functions and thendouble-click on the DebugRun link. When the breakpoint isencountered, the line of code will become highlighted in theeditor, as shown:

(c) Sparx Systems 2018 Page 21 of 885

User Guide - Automation 26 July, 2018

Java Example

This sample program demonstrates how easy it is tonavigate, query and report on the current model using ahigh-level language such as Java.

When run, it will print the names of every Package in thecurrently-loaded model.

Create the project

In the Project Browser, select the Package in which to createthe template, then use the ribbon or context menu to displaythe Model Wizard; click on the 'Application Patterns' tab.

From this tab, select the Java > RepositoryInterfacetemplate. Specify the destination folder on the file system inwhich the project template will be created, and click on theOK button.

Open the project

A Package structure similar to this will be created for you.

(c) Sparx Systems 2018 Page 22 of 885

User Guide - Automation 26 July, 2018

Expand the structure until you locate the 'RepositoryInterface' diagram and open it.

Overview:

This sample program demonstrates how easy it is to navigate, query and report on the current model using a high level language such as Java. When run, it will print the names of every Package in the currently loaded model.

Framework:The build uses the compiler from the Java JDK 1.7 x86 framework.

Version:1.7

Note:In order to use the Build, Run and Debug links, you must first locate the 'Repository Interface' Analyzer Script generated by the wizard, and make it the active script for the model.You can use the 'Analyzer Scripts' link to do this.

BuildBuild the project

RunRun your program

Debug the program *DebugRun

Analyzer Scripts

RepositoryInterface

- m_eapid: int = 0- m_repository: org.sparx.Repository = null

+ Demo(): void+ finalize(): void~ main(String[]): void+ RepositoryInterface()+ RepositoryInterface(int)

Build the script

The commands on the diagram will operate on the activebuild configuration. Before executing them, double-click onthe Analyzer Scripts link and select the checkbox next to the'Repository Interface' build configuration.

(c) Sparx Systems 2018 Page 23 of 885

User Guide - Automation 26 July, 2018

Run the script

Double-click on the Run link; a Console will open. TheConsole will pause after completion so you can read theoutput. The output from the program will also be output tothe 'Script' tab of the System Output window. You can alterthis by changing the code.

Debug the script

Select the 'Program' Class from the Project Browser andpress Ctrl+E to open the source code.

Place a breakpoint in one of the functions and thendouble-click on the DebugRun link. When the breakpoint isencountered the line of code will become highlighted in theeditor, as shown.

(c) Sparx Systems 2018 Page 24 of 885

User Guide - Automation 26 July, 2018

Scripting

Enterprise Architect's scripting environment is a flexible andeasy to use facility that supports both JavaScript and theMicrosoft scripting languages JScript and VBScript. Whenany script runs, it has access to a built-in 'Repository' object.Using this script object you can programmatically inspectand/or modify elements within your currently open model.Enterprise Architect also provides feature rich editors, andtools to run, debug and manage your scripts. Scripts aremodular and can include other scripts by name using the!include directive. They can be used for a broad range ofpurposes, from documentation to validation and refactoring,and they can be of enormous help with automating timeconsuming tasks.

Script Engine Support

Mozilla SpiderMonkey [ version 1.8 ]·

Microsoft Scripting Engine·

(c) Sparx Systems 2018 Page 25 of 885

User Guide - Automation 26 July, 2018

Script Languages

JavaScript·

JScript·

VBScript·

Benefits

Inspecting and reporting on model and element·

composition

Modifying and updating element properties·

Running queries to obtain extended model information·

Modifying diagram layouts·

Being called from report document templates to populate·

reports

Creating and implementing process workflows·

Being included in MDG Technologies to augment domain·

specific languages

Extensive UI access to scripts through context menus·

Automation Server role for in-process and out-of-process·

COM clients (Scripting is itself an example of anin-process client; Add-ins are another)

Element access governance through Workflow security·

Model Search integration·

(c) Sparx Systems 2018 Page 26 of 885

User Guide - Automation 26 July, 2018

Script Groups

Scripts are managed and contained in groups. Each grouphas an attribute called 'Type'. This attribute is used to helpEnterprise Architect decide how and where the script can beused and from which features it should be made available.The properties of a script group can be viewed from itsshortcut menu.

Script Storage

Built in scripts are file based and are installed withEnterprise Architect. They appear under the Local Scriptsgroup.

You cannot edit or delete Local scripts, but you can copy thecontents easily enough.

User defined scripts are model based and as such, can beshared by a community. They are listed in the group towhich they belong..

(c) Sparx Systems 2018 Page 27 of 885

User Guide - Automation 26 July, 2018

Using Scripts

The management interface for Scripting is the Scriptingwindow, which contains the:

Script Tree View ('Scripts' tab), which you use to review,·

create and edit scripts

Script Console ('Console' tab), which you use to operate·

on an executing script

Other than the Local Scripts, which are file based andinstalled with Enterprise Architect, all other scripts arestored as model assets and can be shared with its users.Script debuggers can help you with script development andscript editors can provide you with information on theautomation interfaces available to you. Analyze theexecution; for example, by recording a Sequence diagram ofthe script execution, and halting execution to view localvariables.

Notes

This facility is available in the Corporate, Unified and·

Ultimate editions

If you intend to use the Scripting facility under·

Crossover/WINE, you must also install Internet Explorerversion 6.0 or above

(c) Sparx Systems 2018 Page 28 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 29 of 885

User Guide - Automation 26 July, 2018

Scripts Tab

The 'Scripts' tab is composed of a toolbar and a view of allscripts according to group. The script groups and theirscripts also have context menus that provide some or all ofthese options:

Group Properties - to display or edit script group·

properties in the 'Script Group Properties' dialog

Run Script - to execute the selected script (or press Ctrl·

while you double-click on the script name)

Edit Script - to update the selected script (or double-click·

on the script name to display the 'Script Editor', whichusually displays a script template, determined by the usergroup type as assigned on creation or on the 'Script GroupProperties' dialog)

Rename Script - to change the name of the selected group·

or script

New VBScript/JScript/JavaScript - add a new script to the·

selected user group

Import Workflow Script - to display the 'Browser' dialog·

through which you locate and select a workflow scriptsource (.vbs) file to import into the Workflow script folder

Delete Group/Script - to delete the selected user group or·

script

You can also move or copy a script from one user scriptsfolder to another; to:

Move a script, highlight it in the 'Scripts' tab and drag it·

(c) Sparx Systems 2018 Page 30 of 885

User Guide - Automation 26 July, 2018

into the user scripts folder it now belongs to

Copy a script, highlight it in the 'Scripts' tab and press Ctrl·

while you drag it into the user scripts folder in which toduplicate it

Access

Ribbon Specialize > Tools > Scripting > Scripts

Script Toolbar

Icon Action

Create a new script group; this optiondisplays a short menu of the types ofscript group you can create, namely:

Normal Group ( )·

Project Browser Group ( )·

Diagram Group ( )·

Workflow Group ( )·

Search Group ( )·

Model Search Group·

The new group is added to the end of the

(c) Sparx Systems 2018 Page 31 of 885

User Guide - Automation 26 July, 2018

list in the Scripting window, with the'New group' text highlighted so that youcan type in the group name.

Create a new script file in the selectedscript group; displays a short menu of thetypes of script you can create, namely:

VBScript ( )·

JScript ( )·

JavaScript ( )·

The new script is added to the end of thelist in the selected group, with the 'Newscript' text highlighted so that you cantype in the script name.

Refresh the script tree in the Scriptingwindow; this icon also reloads anychanges made to a workflow script.

Compile and execute the selected script.The output from the script is written tothe 'Script' tab of the System Outputwindow, which you display using theView Script Output button.

Stop an executing script; the icon isdisabled if no script is executing.

(c) Sparx Systems 2018 Page 32 of 885

User Guide - Automation 26 July, 2018

Delete a script from the model; youcannot use this icon to delete a scriptgroup (see the earlier 'Context Menu'item), scripts in the 'Local Scripts' group,or a script that is executing.The system prompts you to confirm thedeletion only if the 'Confirm Deletes'checkbox is selected in the 'ProjectBrowser' panel of the 'General' page ofthe 'Preferences' dialog; if this option isnot selected, no prompt is displayed.Script deletion is permanent - scriptscannot be recovered.

Display the System Output window withthe results of the most recently executedscript displayed in the 'Script' tab.

Notes

This facility is available in the Corporate, Unified and·

Ultimate editions

If you add, delete or change a script, you might have to·

reload the model in order for the changes to take effect

If you select to delete a script group that contains scripts,·

(c) Sparx Systems 2018 Page 33 of 885

User Guide - Automation 26 July, 2018

the system always prompts you to confirm the actionregardless of any system settings for delete operations; becertain that you intend to delete the group and its scriptsbefore confirming the deletion - deletion of script groupsand scripts is permanent

(c) Sparx Systems 2018 Page 34 of 885

User Guide - Automation 26 July, 2018

Console Tab

The script console is a tab of the Scripting window; it is acommand line interpreter through which you can quicklyenable a script engine and enter commands to act on thescript.

You type the commands in the field at the bottom of the tab;when you press the Enter key, the script console executesthe commands and displays any output immediately.

You can input two types of command:

Console commands·

Script commands·

Access

Ribbon Specialize > Tools > Scripting > Console

Console Commands

Console commands are preceded by the ! character andinstruct the console to perform an action.

The available console commands are provided here; to listthese commands on the 'Console' tab itself, type ? in the

(c) Sparx Systems 2018 Page 35 of 885

User Guide - Automation 26 July, 2018

console field (without the preceding ! character) and pressthe Enter key.

c(lear) - clears the console display·

sa(ve) - saves the console display to a file·

h(elp) - prints a list of commands, as for ?·

VB - opens a VBScript console·

JA - opens a JavaScript console·

JS - opens a JScript console·

st(op) - closes any script running console·

i(nclude) name - executes the named script item; name is·

of the format GroupName.ScriptName (spaces areallowed in names)

? - (without the !) lists commands·

?name - Outputs the value of a variable name (only if a·

script console is opened).

Script Commands

A script command is script code that depends on the scriptengine. Script commands can be executed only once a scriptconsole has been created.

Examples:

These lines, entered into the console, create a VBScriptconsole and then execute the script 'MyScript' in the usergroup 'MyGroup':

(c) Sparx Systems 2018 Page 36 of 885

User Guide - Automation 26 July, 2018

>!VB

>!i MyGroup.MyScript

These lines, entered into the console, create a JScriptconsole and then create a variable called x with the value 1:

>!JS

>var x = 1

This image shows the result of entering the above JScriptexample; remember that you can use ?<variable name> toget the current value of any item you have created duringthe console session.

Console Tab Toolbar

The 'Console' tab has two operations available through thetoolbar:

Open Console ( ) - click on the down-arrow and select to·

open a VBScript console, JScript console or JavaScriptconsole

Stop Script ( ) - click to stop an executing script and·

close the current console

(c) Sparx Systems 2018 Page 37 of 885

User Guide - Automation 26 July, 2018

Notes

This facility is available in the Corporate, Unified and·

Ultimate editions

You can save the output of the console to an external .txt·

file; right-click on the console window, select the 'SaveAs' option, browse for an appropriate file location andspecify the file name

(c) Sparx Systems 2018 Page 38 of 885

User Guide - Automation 26 July, 2018

Script Group Properties

When you create a script you develop it within a scriptgroup, the properties of which determine how that script isto be made available to the user - through the ProjectBrowser context menu to operate on objects of a specifictype, or through a diagram context menu. You create aScript Group using the first icon on the 'Scripts' tab toolbar.

Access

Ribbon Specialize > Tools > Scripting > Scripts >right-click on [Group name] > Group

(c) Sparx Systems 2018 Page 39 of 885

User Guide - Automation 26 July, 2018

Properties

Define the Script Group Properties

Field/Button Action

Name Type in the name of the script group.

Group UID (Read only) The automatically assignedGUID for the group.

Source (Read only) The location of the templateused to create the script.

Group Type Click on the drop-down arrow and selectthe type of script contained in the group;this can be one of:

Normal - ( ) General model scripts·

Project Browser - ( ) Scripts that are·

listed in and can be executed from theProject Browser 'Scripts' context menuoptionWorkflow - ( ) Scripts executed by·

Enterprise Architect's workflowengine; you can create only VB scripts

(c) Sparx Systems 2018 Page 40 of 885

User Guide - Automation 26 July, 2018

of this typeSearch - ( ) Scripts that can be·

executed as model searches; thesescripts are listed in the 'Search' field ofthe Model Search window, in the lastcategory in the listDiagram - ( ) Scripts that can be·

executed from the 'Scripts' submenu ofthe diagram context menuFind in Project - ( ) Scripts that can be·

executed from the 'Scripts' submenu ofa context menu within the ModelSearch view, on the results of asuccessfully-executed SQL search thatincludes CLASSGUID andCLASSTYPE, or a Query-built searchElement - Scripts that can be executed·

from the 'Scripts' submenu of elementcontext menus; accessible from theProject Browser, Diagram, ModelSearch, Element List, Package Browserand Gantt viewsPackage - Scripts that can be executed·

from the 'Scripts' submenu of Packagecontext menus; accessible from theProject BrowserDiagram - Scripts that can be executed·

from the 'Scripts' context menu optionfor diagrams; accessible from the

(c) Sparx Systems 2018 Page 41 of 885

User Guide - Automation 26 July, 2018

Project Browser and diagramsLink - Scripts that can be executed·

from the 'Scripts' context menu optionfor connectors; accessible fromdiagrams

Notes Type in any comments you needregarding this script group.

(c) Sparx Systems 2018 Page 42 of 885

User Guide - Automation 26 July, 2018

Script Editor

Using the Script Editor you can perform a number ofoperations on an open script file, such as:

Save changes to the current script·

Save the current script under a different name·

Run the script·

Debug the script·

Stop the executing script·

View the script output in the 'Scripts' tab of the System·

Output window

The editor is based on, and provides the facilities of, thecommon Code Editor in the application work area.

Access

Ribbon Specialize > Tools > Scripting > Scripts >right-click on [script name] > Edit ScriptorSpecialize > Tools > Scripting > Scripts >double-click on [script name]

(c) Sparx Systems 2018 Page 43 of 885

User Guide - Automation 26 July, 2018

Facilities

Facility Detail

ScriptingObjects

Enterprise Architect adds to the availablefunctionality and features of the editorscript language by providing inbuiltobjects; these are either Type Librariesproviding Intelli-sense for editingpurposes, or Runtime objects providingaccess to objects of the types described inthe Type Libraries.The available Intelli-sense scriptingobjects are:

EA·

MathLib·

System·

The runtime scripting objects are:Repository (Type: IDualRepository, an·

instance of EA.Repository, theEnterprise Architect AutomationInterface)Maths (Type: IMath, an instance of·

MathLib; this exposes functions fromthe Cephes mathematical library foruse in scripts)Session (Type: ISession, an instance of·

(c) Sparx Systems 2018 Page 44 of 885

User Guide - Automation 26 July, 2018

System)

ScriptEditingIntelli-sense(RequiredSyntax)

Intelli-sense is available not only in the'Script Editor', but also in the 'ScriptConsole'; Intelli-sense at its most basic ispresented for the inbuilt functionality ofthe script engine.For Intelli-sense on the additionalEnterprise Architect scripting objects (aslisted) you must declare variablesaccording to syntax that specifies a type;it is not necessary to use this syntax toexecute a script properly, it is onlypresent so that the correct Intelli-sensecan be displayed for an item.The syntax can be seen in, for example: Dim e as EA.ElementThen when you type, in this case, e., theeditor displays a list of member functionsand properties of e's type.You select one of these to complete theline of script; you might, therefore, type: VBTrace(e.As you type the period, the editorpresents the appropriate list and youmight double-click on, for example,Abstract; this is inserted in the line, andyou continue to type or select the rest of

(c) Sparx Systems 2018 Page 45 of 885

User Guide - Automation 26 July, 2018

the statement, in this case adding the endspace and parenthesis: VBTrace(e.Abstract)

Keystrokes In the Script Editor or Console,Intelli-sense is presented on thesekeystrokes.

Press . (period) after an item to list any·

members for that item's typePress Ctrl+Spacebar on a word to list·

any Intelli-sense items with a namestarting with the string at the point thekeys were pressedPress Ctrl+Spacebar when not on a·

word to display any available top levelIntelli-sense items - these are theIntelli-sense objects described aboveplus any built-in methods andproperties of the current scriptinglanguage

Include scriptlibraries

An Include statement (!INC) allows ascript to reference constants, functionsand variables defined by another scriptaccessible within the Scripting Window.Include statements are typically used atthe beginning of a script.To include a script library, use thissyntax:

(c) Sparx Systems 2018 Page 46 of 885

User Guide - Automation 26 July, 2018

!INC [Script Group Name].[ScriptName]For example: !INC LocalScripts.EAConstants-VBScript

Using InbuiltMathFunctions

Various mathematical functions areavailable within the Script Editor,through the use of the inbuilt Mathsobject.You can access the Maths object withinthe Script Editor by typing 'Maths'followed by a period. The Intelli-sensefeature displays a list of the availablemathematical functions provided by theCephes Mathematical Library. Forexample: Session.Output "The square root of 9 is" & Maths.sqrt(9) Session.Output "2^10 = " &Maths.pow(2,10)The Maths object is available in theUnified and Ultimate editions ofEnterprise Architect.

Using COM /ActiveXObjects

VBScript, JScript and JavaScript caneach create and work with ActiveX /COM objects. This can help you to workwith external libraries, or to interact with

(c) Sparx Systems 2018 Page 47 of 885

User Guide - Automation 26 July, 2018

other applications external to EnterpriseArchitect. For example, theScripting.FileSystemObject Class can beused to read and write files on the localmachine. The syntax for creating a newobject varies slightly for each language,as illustrated by these examples:VBScript: set fsObject =CreateObject("Scripting.FileSystemObject")JScript: fsObject = newActiveXObject("Scripting.FileSystemObject");JavaScript: fsObject = newCOMObject("Scripting.FileSystemObject");

UsingJavaScriptwithout-of-process COMservers

Users of JavaScript in EnterpriseArchitect can access out-of-process COMservers. The application must beregistered on the machine as providinglocal server support. The syntax forcreating or obtaining a reference to anout-of-process server is: var server = new COMObject(progID,

(c) Sparx Systems 2018 Page 48 of 885

User Guide - Automation 26 July, 2018

true);where progID is the registered programID for the COM component('Excel.Application', for example).

SystemScriptLibrary

When Enterprise Architect is installed onyour system, it includes a default scriptlibrary that provides a number of helpfulscripting functions, varying from simplestring functions to functions for definingyour own CSV or XMI import andexport.To use the script library you must enableit in the 'MDG Technologies' dialog('Specialize > Technologies > Manage'ribbon option).Scroll through the list of technologies,and select the 'Enabled' checkbox against'EAScriptLib'.

Notes

The Script Editor is available in the Corporate, Unified·

and Ultimate editions

Enterprise Architect scripting supports declaring variables·

to match the Enterprise Architect types; this enables the

(c) Sparx Systems 2018 Page 49 of 885

User Guide - Automation 26 July, 2018

editor to present Intelli-sense, but is not necessary forexecuting the script

(c) Sparx Systems 2018 Page 50 of 885

User Guide - Automation 26 July, 2018

Session Object

The Session runtime object provides a commoninput/feedback mechanism across all script languages,giving access to objects of the types described in the SystemType library. It is available through both the 'Scripts' tab andthe script 'Console' tab to any script run within EnterpriseArchitect.

Properties

Properties Detail

Attributes UserName - Returns the current·

windows username (read only)Version - Returns the version of this·

object (read only)

Methods Input(string Prompt) - displays a dialog·

box prompting the user to input avalue; returns the string value that wasentered by the userOutput(string Output) - writes text to·

the current default output location;during: - Normal script execution, output iswritten to the 'Script' tab of the System

(c) Sparx Systems 2018 Page 51 of 885

User Guide - Automation 26 July, 2018

Output window - Script Debugging, output is writtento the Debug window - Use of the Script Console, output iswritten to the ConsolePrompt(string Prompt, long·

PromptType) - displays a modal dialogcontaining the specified prompt textand button types; returns the'PromptResult' value corresponding tothe button that the user clicked

PromptTypevalues

promptOK = 1·

promptYESNO = 2·

promptYESNOCANCEL = 3·

promptOKCANCEL = 4·

PromptResultvalues

resultOK = 1·

resultCancel = 2·

resultYes = 3·

resultNo = 4·

Session.Prompt Example

(VBScript)If (Session.Prompt("Continue?",promptYESNO) = resultYes) Then...

(c) Sparx Systems 2018 Page 52 of 885

User Guide - Automation 26 July, 2018

Script Debugging

Script debugging aids in the development and maintenanceof model scripts, and monitoring their activity at the time ofexecution. While debugging a script, you can:

Control execution flow using the 'Debug', 'Step Over',·

'Step Into', 'Step Out' and 'Stop Script' buttons on theScript Editor toolbar

Set Breakpoints, Recording Markers and Tracepoint·

Markers

Use the Debug window to view output generated by the·

script

Use the Locals window to inspect values of variables,·

including objects from the Automation Interface

Use the Record & Analyze window to record a Sequence·

diagram of the script execution

Access

Ribbon Specialize > Tools > Scripting > Scripts >right-click on [script name] > DebugScript

Other Script Editor window toolbar : Click onthe toolbar icon

(c) Sparx Systems 2018 Page 53 of 885

User Guide - Automation 26 July, 2018

Begin debugging a model script

Step

Action

1 Open a model script in the Script Editor.

2 Set any Breakpoints on the appropriate line(s) ofcode.

3 Click on the toolbar icon (Debug).

Notes

Script debugging is supported for VBScript, JScript and·

JavaScript

VBScript and JScript require the Microsoft Process·

Debug Manager to be installed on the local machine; thisis available through various Microsoft products includingthe free 'Microsoft Script Debugger'

Breakpoints are not saved for scripts and will not persist·

when the script is next opened

(c) Sparx Systems 2018 Page 54 of 885

User Guide - Automation 26 July, 2018

While debugging, script output is redirected to the Debug·

window

(c) Sparx Systems 2018 Page 55 of 885

User Guide - Automation 26 July, 2018

Enterprise Architect Object Model

The Enterprise Architect Object Model gives the scripter orprogrammer access to the underlying objects that you canuse to query or manipulate the repository. The Object Modelis accessible either from internal or external scriptingenvironments or through Add-Ins. This is a powerful featurethat ensures that a programmer is insulated from theunderlying database where the repository is stored,protecting them from changes to the database structure orcontent. The objects are grouped into Packages and containa useful, extensive and well documented set of propertiesand methods that are intuitive to use and allow access toelements, features, diagrams and project meta-data.

Automation provides a way for other applications to accessthe information in an Enterprise Architect model usingWindows OLE Automation (ActiveX). Typically thisinvolves scripting clients such as MS Word or Visual Basic,or using scripts created within Enterprise Architect using theScripting window.

The Automation Interface provides a way of accessing theinternals of Enterprise Architect models. Examples of thingsyou can do using the Automation Interface include:

Perform repetitive tasks, such as update the version·

number for all elements in a model

(c) Sparx Systems 2018 Page 56 of 885

User Guide - Automation 26 July, 2018

Generate code from a StateMachine diagram·

Produce custom reports·

Perform ad hoc queries·

Features

Feature Description

Connectingto theAutomationInterface

All development environments capable ofgenerating ActiveX COM clients shouldbe able to connect to the EnterpriseArchitect Automation Interface. Thisguide provides detailed instructions onconnecting to the interface usingMicrosoft Visual Basic 6.0, BorlandDelphi 7.0, Microsoft C# and Java. Thereare also more detailed steps on how toset-up Visual Basic; the principles areapplicable to other languages.

Examplesand Tips

Instruction on how to use the AutomationInterface is provided by means of samplecode. See pointers to the samples andother available resources. Also, consultthe extensive Reference Section.

CallingExecutables

Enterprise Architect can be set up to callan external application. You can pass

(c) Sparx Systems 2018 Page 57 of 885

User Guide - Automation 26 July, 2018

fromEnterpriseArchitect

parameters on the current positionselected in the Project Browser to theapplication being called. For instructions,go to the Call from Enterprise Architecttopic. A more sophisticated method is tocreate Add-Ins, which are discussed in aseparate section.

(c) Sparx Systems 2018 Page 58 of 885

User Guide - Automation 26 July, 2018

Using the Automation Interface

This section provides instructions on how to connect to anduse the Automation Interface, including:

Connecting to the interface·

Setting references in Visual Basic·

Examples and Tips·

(c) Sparx Systems 2018 Page 59 of 885

User Guide - Automation 26 July, 2018

Connect to the Interface

All development environments capable of generatingActiveX Com clients can connect to the Enterprise ArchitectAutomation Interface.

By way of example, these sections describe how to connectusing several such tools. The procedure might vary slightlywith different versions of these products.

Microsoft Visual Basic 6.0

Step

Action

1 Create a new project.

2 Select the 'Project | References' menu option.

3 Select Enterprise Architect Object Model 2.0 fromthe list.If this does not appear, go to the command line andre-register Enterprise Architect using: EA.exe /unregisterthen EA.exe /register

(c) Sparx Systems 2018 Page 60 of 885

User Guide - Automation 26 July, 2018

4 See the general library documentation on the use ofClasses. This example creates and opens a repositoryobject: Public Sub ShowRepository() Dim MyRep As New EA.Repository MyRep.OpenFile "c:\eatest.eap" End Sub

Borland Delphi 7.0

Step

Action

1 Create a new project.

2 Select the 'Project | Import Type Library' menuoption.

3 Select Enterprise Architect Object Model 2.0 fromthe list.If this does not appear, go to the command line andre-register Enterprise Architect using: EA.exe /unregisterthen EA.exe /register

(c) Sparx Systems 2018 Page 61 of 885

User Guide - Automation 26 July, 2018

4 Click on the Create Unit button.

5 Include EA_TLB in Project1's Uses clause.

6 See the general library documentation on the use ofClasses. This example creates and opens a repositoryobject: procedure TForm1.Button1Click(Sender:TObject); var r: TRepository; b: boolean; begin r:= TRepository.Create(nil); b:= r.OpenFile('c:\eatest.eap'); end;

Microsoft C#

Step

Action

1 Select the 'Visual Studio Project | Add Reference'menu option.

(c) Sparx Systems 2018 Page 62 of 885

User Guide - Automation 26 July, 2018

2 Click on the 'Browse' tab.

3 Navigate to the folder in which you installedEnterprise Architect; usually: Program Files/Sparx Systems/EASelect Interop.EA.dll

4 See the general library documentation on the use ofClasses. This example creates and opens a repositoryobject: private void button1_Click(object sender,System.EventArgs e) { EA.Repository r = new EA.Repository(); r.OpenFile("c:\\eatest.eap"); }

Java

Step

Action

1 Copy the file:

(c) Sparx Systems 2018 Page 63 of 885

User Guide - Automation 26 July, 2018

SSJavaCOM.dllfrom the Java API subdirectory of your installeddirectory, usually: Program Files/Sparx Systems/EAinto any location within the Windows PATH windows\system32 directory.

Note: Under 64-bit operating systems, theSSJavaCOM.dll file must be copied intoC:\Windows\SysWOW64.Under 64-bit versions of Windows, the 'System32'directory is for 64-bit applications, and 'SysWOW64'is for 32-bit applications.

2 Copy the file eaapi.jarfrom the Java API subdirectory of your installeddirectory, usually: Program Files/Sparx Systems/EAto a location in the Java CLASSPATH or where theJava class loader can find it at run time.

3 All of the Classes described in the documentation arein the Package org.sparx. See the general librarydocumentation for their use. This example createsand opens a repository object: public void OpenRepository()

(c) Sparx Systems 2018 Page 64 of 885

User Guide - Automation 26 July, 2018

{ org.sparx.Repository r = neworg.sparx.Repository(); r.OpenFile("c:\\eatest.eap"); }

(c) Sparx Systems 2018 Page 65 of 885

User Guide - Automation 26 July, 2018

Set References In Visual Basic

It is possible to use the Enterprise Architect ActiveXinterface with Visual Basic (VB). Use is ensured for VisualBasic version 6, but might vary slightly with versions otherthan version 6.

It is assumed that you have accessed VB through aMicrosoft Application such as VB 6.0, MS Word or MSAccess. If the code is not called from within Word, theWord VB reference must also be set.

On creating a new VB project, you set a reference to anEnterprise Architect Type Library and a Word Type Library.

Set References

Step

Action

1 Select the 'Tools | References' menu option.

2 Select the 'Enterprise Architect Object Model 2.10'checkbox from the list.

3 Do the same for VB or VB Word: select thecheckbox for the 'Microsoft Word 10.0 ObjectLibrary'.

(c) Sparx Systems 2018 Page 66 of 885

User Guide - Automation 26 July, 2018

4 Click on the OK button.

Notes

If 'Enterprise Architect Object Model 2.10' does not·appear in the list, go to the command line and manuallyre-enter Enterprise Architect using: - (To unregister Enterprise Architect) ea.exe /unregister - (To register Enterprise Architect) ea.exe /register

Visual Basic 5/6 users should also note that the version·number of the Enterprise Architect interface is stored inthe VBP project file in a form similar to this:

Reference=*\G{64FB2BF4-9EFA-11D2-8307-C45586000000}#2.2#0#..\..\..\..\Program Files\ Sparx Systems\EA\EA.TLB#Enterprise ArchitectObject Model 2.02If you experience problems moving from one version ofEnterprise Architect to another, open the VBP file in atext editor and remove this line, then open the project inVisual Basic and use Project-References to create a newreference to the Enterprise Architect Object modelReference to objects in Enterprise Architect and Wordshould now be available in the Object Browser, which canbe accessed from the main menu by pressing F2The drop-down list on the top-left of the window shouldnow include Enterprise Architect and Word; if

(c) Sparx Systems 2018 Page 67 of 885

User Guide - Automation 26 July, 2018

MS-Project is installed, also set this up

(c) Sparx Systems 2018 Page 68 of 885

User Guide - Automation 26 July, 2018

Examples and Tips

Points to consider

Subject Points

Examples Instructions for using the interface areprovided through sample code. There areseveral sets of examples:

VB 6 and C# examples are available in·

the Code Samples folder under yourEnterprise Architect installation(default: C:\Program Files\SparxSystems\EA\Code Samples)Enterprise Architect can be set up to·

call an external applicationSeveral VB.NET code snippets are·

provided in the reference sectionA comprehensive example of using·

Visual Basic to create MS Worddocumentation is available from theinternet atwww.sparxsystems.com/resources/developers/autint_vb.htmlAdditional samples are available from·

the Sparx Systems website; see theAvailable Resources topic

(c) Sparx Systems 2018 Page 69 of 885

User Guide - Automation 26 July, 2018

Tips andTricks

Also note these tips and tricks:An instance of the Enterprise Architect·

(EA.exe) process is executed when youinitialize a new repository object - thisprocess must remain running in orderto perform automation tasks; if themain window is visible, you can safelyminimize it, but it must remain runningThe Enterprise Architect ActiveX·

Interface is a functional interface ratherthan a data interface; when you loaddata through the interface there is anoticeable delay as Enterprise Architectuser interface elements (such asWindows and menus) are loaded andthe specified database connection isestablishedCollections use a zero-based index; for·

example, Repository.Models(0)represents the first model in therepositoryDuring the development of your client·

software your program might terminateunexpectedly and leave EA.exerunning in such a state that it is unableto support further interface calls; ifyour program terminates abnormally,ensure that Enterprise Architect is not

(c) Sparx Systems 2018 Page 70 of 885

User Guide - Automation 26 July, 2018

left running in the background (see theWindows 'Task Manager / Process' tab)A handle to a currently running·

instance of Enterprise Architect can beobtained through the use of aGetObject() call (see the reference pagefor the App object); accessing yourEnterprise Architect model via the Appobject enables querying the currentUser Interface status, such as usingGetContextItem() on the Repositoryobject to detect the current selection bythe user, allowing for rapid prototypingand testing

EnterpriseArchitect NotClosing

After all processing by an automationcontroller is complete, it is recommendedto call CloseFile() and Exit() on theRepository object, then set all referencesto the repository object to null. repository.CloseFile(); repository.Exit(); repository = null;If your automation controller was writtenusing the .NET framework, EnterpriseArchitect does not close even after yourelease all your references to it. To forcethe release of the COM pointers, call thememory management functions:

(c) Sparx Systems 2018 Page 71 of 885

User Guide - Automation 26 July, 2018

GC.Collect(); GC.WaitForPendingFinalizers();There are additional concerns whencontrolling a running instance ofEnterprise Architect that loads Add-Ins -see the Tricks and Traps topic for details.

(c) Sparx Systems 2018 Page 72 of 885

User Guide - Automation 26 July, 2018

Call from Enterprise Architect

Enterprise Architect can be set up to call an externalapplication. You can pass parameters on the current positionselected in the Project Browser to the application beingcalled. This helps you to:

Add a command line for an application·

Define parameters to pass to this application·

The parameters required for running the AutInt executableare:

The Enterprise Architect file parameter $f and·

The current PackageID $p·

Hence the arguments should simply contain: $f,$p.

Once this has been set up, the application can be called fromthe 'Extend' ribbon in Enterprise Architect using the 'Extend> <YourApplication>' option.

Access

Ribbon Start > View > Preferences > Customize> Tools

Parameters to pass information to external

(c) Sparx Systems 2018 Page 73 of 885

User Guide - Automation 26 July, 2018

applications

Parameter Description

$d Diagram IDNotes: ID for accessing associateddiagram.

$D Diagram GUIDNotes: GUID for accessing the associateddiagram.

$e Comma separated list of element IDsNotes: All elements selected in thecurrent diagram.

$E Comma separated list of element GUIDsNotes: All elements selected in thecurrent diagram.

$f Project NameNotes: For example:C:\projects\EAexample.eap.

$F Calling Application (EnterpriseArchitect)Notes: 'Enterprise Architect'.

(c) Sparx Systems 2018 Page 74 of 885

User Guide - Automation 26 July, 2018

$p Current Package IDNotes: For example: 144.

$P Package GUIDNotes: GUID for accessing this Package.

(c) Sparx Systems 2018 Page 75 of 885

User Guide - Automation 26 July, 2018

Available Resources

Resources

Available resources include:

Resource Download Link

VB 6 Add-InforgeneratingMS Worddocumentation.

www.sparxsystems.com/resources/developers/autint_vb.html

VB 6 Add-Into display acustomActiveXgraph controlwithin theEnterpriseArchitectwindow as anew view.

www.sparxsystems.com/resources/developers/autint_vb_custom_view.html

A basicAdd-Inframework

www.sparxsystems.com/bin/CS_AddinFramework.zip

(c) Sparx Systems 2018 Page 76 of 885

User Guide - Automation 26 July, 2018

written in C#.Useful as astarting pointfor authoringyour owncustomEnterpriseArchitectAdd-In.

An extensionon theCS_AddinFrameworkexampleshowing howto exportTaggedValues to a.csv file.

www.sparxsystems.com/bin/CS_AddinTaggedCSV.zip

A basicAdd-Inskeletonwritten inDelphi.

www.sparxsystems.com/bin/DelphiDemo.zip

A simpleexample

www.sparxsystems.com/bin/CS_Sample.zip

(c) Sparx Systems 2018 Page 77 of 885

User Guide - Automation 26 July, 2018

Add-Inwritten in C#.

(c) Sparx Systems 2018 Page 78 of 885

User Guide - Automation 26 July, 2018

Reference

This section provides detailed information on all the objectsavailable in the object model provided by the AutomationInterface, including:

Object Groups

Group

App Object

Enumerations

Repository Package

Element Package

Element Features Package

Connector Package

Diagram Package

Project Interface Package

(c) Sparx Systems 2018 Page 79 of 885

User Guide - Automation 26 July, 2018

Document Generator Interface Package

Mail Interface Package

Code Samples

(c) Sparx Systems 2018 Page 80 of 885

User Guide - Automation 26 July, 2018

Interface Overview

This section provides an overview of the main componentsof the Automation Interface.

Main Packages of Automation Interface

Package Detail

RepositoryPackage

Represents the model as a whole andprovides entry to model Packages andcollections.

ElementPackage

Identifies the basic structural units (suchas Class, Use Case and Object).

ElementFeaturesPackage

Identifies the attributes and operationsdefined on an element.

DiagramPackage

Describes the visible drawings containedin the model.

ConnectorPackage

Defines the relationships betweenelements.

(c) Sparx Systems 2018 Page 81 of 885

User Guide - Automation 26 July, 2018

Packages and Contents

This diagram illustrates the main interface Packages andtheir associated contents. Each UML element in this UserGuide can be created by Automation and can be accessedeither through the various collections that exist or, in somecases, directly.

The Repository Class is the starting point for all use of theAutomation Interface. It contains the high level systemobjects and entry point into the model itself using theModels collection and the other system-level collections.

(c) Sparx Systems 2018 Page 82 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 83 of 885

User Guide - Automation 26 July, 2018

App Object

The App object represents a running instance of EnterpriseArchitect. Its object provides access to the AutomationInterface.

Attributes

Attribute Type

Project ProjectNotes: Read onlyProvides a handle to the Project Interface.

Repository RepositoryNotes: Read onlyProvides a handle to the Repositoryobject.

Visible BooleanNotes: Read/WriteWhether or not the application is visible.

(c) Sparx Systems 2018 Page 84 of 885

User Guide - Automation 26 July, 2018

GetObject() Support

The App object is creatable and a handle can be obtained bycreating one. In addition, clients can use the equivalent ofVisual Basic's GetObject() to obtain a reference to acurrently running instance of Enterprise Architect.

Use this method to more quickly test changes to Add-Insand external clients, as the Enterprise Architect applicationand data files do not have to be constantly re-loaded.

For example:

Dim App as EA.App

Set App = GetObject(,"EA.App")

MsgBox App.Repository.Models.Count

Another example, which uses the App object without savingit to a variable:

Dim Rep as EA.Repository

Set Rep = GetObject(, "EA.App").Repository

MsgBox Rep.ConnectionString

(c) Sparx Systems 2018 Page 85 of 885

User Guide - Automation 26 July, 2018

Enumerations

These enumerations are defined by the AutomationInterface:

Automation Interface Enumerations

Enumeration Link

ConstantLayout Styles

Constant Layout Styles

CreateBaseline Flag

Create Baseline Flag

Create ModelType

Create Model Type

DocumentBreak

Document Break

DocumentPageOrientation

Document Page Orientation

DocumentType

Document Type

(c) Sparx Systems 2018 Page 86 of 885

User Guide - Automation 26 July, 2018

EnterpriseArchitectEditionTypes

Enterprise Architect Edition Types

EnumerationRelation SetType

Enumeration Relation Set Type

ExportPackage XMIFlag

Export Package XMI Flag

MailInterfaceMessage Flag

Mail Interface Message Flag

MDG Menus MDG Menus

Object Type Object Type

PropType PropType

Reload Type Reload Type

ScenarioDiagramType

Scenario Diagram Type

(c) Sparx Systems 2018 Page 87 of 885

User Guide - Automation 26 July, 2018

Scenario StepType

Scenario Step Type

Scenario TestType

Scenario Test Type

XMI Type XMI Type

(c) Sparx Systems 2018 Page 88 of 885

User Guide - Automation 26 July, 2018

ConstLayoutStyles

The enum values defined here are used exclusively for the'Lay Out a Diagram' method. You use these values to definethe layout options as provided by the 'Layout > Tools >Diagram Layout ' ribbon option.

Enum Values

Value Meaning

lsCrossReduceAggressive

Perform aggressive Cross-reduction inthe layout process (time consuming).

lsCycleRemoveDFS

Use the Depth First Cycle Removalalgorithm.

lsCycleRemoveGreedy

Use the Greedy Cycle Removalalgorithm.

lsDiagramDefault

Use existing layout options specified forthis diagram.

lsInitializeDFSIn

Initialize the layout using the Depth FirstSearch Inward algorithm.

lsInitializeNa Initialize the layout using the Naïve

(c) Sparx Systems 2018 Page 89 of 885

User Guide - Automation 26 July, 2018

ive Initialize Indices algorithm.

lsInitializeDFSOut

Initialize the layout using the Depth FirstSearch Outward algorithm.

lsLayeringLongestPathSink

Layer the diagram using the Longest PathSink algorithm.

lsLayeringLongestPathSource

Layer the diagram using the Longest PathSource algorithm.

lsLayeringOptimalLinkLength

Layer the diagram using the OptimalLink Length algorithm.

lsLayoutDirectionDown

Direct connectors to point down.

lsLayoutDirectionLeft

Direct connectors to point left.

lsLayoutDirectionRight

Direct connectors to point right.

lsLayoutDirectionUp

Direct connectors to point up.

(c) Sparx Systems 2018 Page 90 of 885

User Guide - Automation 26 July, 2018

lsProgramDefault

Use factory default layout options asspecified by Enterprise Architect.

(c) Sparx Systems 2018 Page 91 of 885

User Guide - Automation 26 July, 2018

CreateBaselineFlag

The CreateBaselineFlag enumeration is used in BaselineManagement, when creating a Baseline.

Enum Values

Value Meaning

cbSaveToStub

Baseline this Package with onlyimmediate children (child Packages areincluded as stubs only).

(c) Sparx Systems 2018 Page 92 of 885

User Guide - Automation 26 July, 2018

CreateModelType

The CreateModelType enumeration is used in theCreateModel method on the Repository Class.

Enum Values

Value Meaning

cmEAPFromBase

Create a copy of the EABase model fileto the specified file path.

cmEAPFromSQLRepository

Create a .eap file shortcut to anSQL-based repository; requires userinteraction to provide SQL connectiondetails.

(c) Sparx Systems 2018 Page 93 of 885

User Guide - Automation 26 July, 2018

DocumentBreak

The DocumentBreak enumeration is used in the InsertBreakmethod on the DocumentGenerator Class.

Enum Values

Value Meaning

breakPage Insert a page break in the document.

breakSection Insert a section break in the document.

(c) Sparx Systems 2018 Page 94 of 885

User Guide - Automation 26 July, 2018

DocumentPageOrientation

The DocumentPageOrientation enumeration is used in theSetPageOrientation method on the DocumentGeneratorClass.

Enum Values

Value Meaning

pagePortrait Sets the current page orientation toPortrait.

pageLandscpae

Sets the current page orientation toLandscape.

(c) Sparx Systems 2018 Page 95 of 885

User Guide - Automation 26 July, 2018

DocumentType

The DocumentType enumeration is used in theSaveDocument method on the DocumentGenerator Class.

Enum Values

Value Meaning

dtRTF Save the document file to disk as an RTFdocument.

dtHTML Save the document file to disk as aHTML document.

dtPDF Save the document file to disk as a PDFdocument.

dtDOCX Save the document file to disk as aDOCX document.

(c) Sparx Systems 2018 Page 96 of 885

User Guide - Automation 26 July, 2018

EAEditionTypes

The EAEditionTypes enumeration identifies the currentlevel of licensed functionality available.

EAEditionTypes theEdition =theRepository.GetEAEdition();

if (theEdition == EAEditionTypes.piProfessional)

...

else if (theEdition == EAEditionTypes.piCorporate)

...

The enumeration defines these formal values:

piLite·

piProfessional·

piCorporate·

piBusiness·

piSystemEng·

piUltimate·

There is no separate value for the trial edition; theRepository.GetEAEdition() function returns the appropriateEAEditionTypes value for whichever edition the user hasselected to trial.

(c) Sparx Systems 2018 Page 97 of 885

User Guide - Automation 26 July, 2018

EnumRelationSetType

This enumeration represents values returned from theGetRelationSet method of the Element object.

Enum Values

Value Meaning

rsDependEnd List of elements that depend on thecurrent element.

rsDependStart

List of elements that the current elementdepends on.

rsGeneralizeEnd

List of elements that are generalized bythe current element.

rsGeneralizeStart

List of elements that the current elementgeneralizes.

rsParents List of all parent elements of the currentelement.

rsRealizeEnd List of elements that are realized by thecurrent element.

(c) Sparx Systems 2018 Page 98 of 885

User Guide - Automation 26 July, 2018

rsRealizeStart

List of elements that the current elementrealizes.

(c) Sparx Systems 2018 Page 99 of 885

User Guide - Automation 26 July, 2018

ExportPackageXMIFlag

The ExportPackageXMIFlag enumeration is used inPackage control, when exporting to XMI.

Enum Values

Value Meaning

epExcludeEAExtensions

Export this Package without any toolspecific information.

epSaveToStub

Export this Package with only immediatechildren (child Packages are included asstubs only).

(c) Sparx Systems 2018 Page 100 of 885

User Guide - Automation 26 July, 2018

MDGMenus

Use this enumeration when providing the 'HiddenMenus'property to MDG_GetProperty.

These options are exclusive of one another and can be reador added to hide more than one menu.

Enum Values

Value Meaning

mgBuildProject

'Hide Build Project' menu option.

mgMerge 'Hide Merge' menu option.

mgRun 'Hide Run' menu option.

(c) Sparx Systems 2018 Page 101 of 885

User Guide - Automation 26 July, 2018

MessageFlag

The MessageFlag enumeration is used in both theSendMailMessage and ComposeMailMessage methods ofthe MailInterface, to specify a flag to attach to the message.

Enum Values

Value Meaning

mfNone Do not flag the message.

mfComplete Flag the message as 'Complete'.

mfPurple Flag the message with a 'Purple' flag.

mfOrange Flag the message with an 'Orange' flag.

mfGreen Flag the message with a 'Green' flag.

mfYellow Flag the message with a 'Yellow' flag.

mfBlue Flag the message with a 'Blue' flag.

mfRed Flag the message with a 'Red' flag.

(c) Sparx Systems 2018 Page 102 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 103 of 885

User Guide - Automation 26 July, 2018

ObjectType

The ObjectType enumeration identifies Enterprise Architectobject types even when referenced through a Dispatchinterface. For example:

var treeSelectedType =Repository.GetTreeSelectedItemType();

switch (treeSelectedType)

{

case otElement :

{

// Code for when an element is selected

var theElement as EA.Element;

theElement = Repository.GetTreeSelectedObject();

break;

}

case otPackage :

{

// Code for when a Package is selected

var thePackage as EA.Package;

thePackage = Repository.GetTreeSelectedObject();

break;

}

}

(c) Sparx Systems 2018 Page 104 of 885

User Guide - Automation 26 July, 2018

Valid Enumeration Values

otAttribute

otAttributeConstraint

otAttributeTag

otAuthor

otClient

otCollection

otConnector

otConnectorConstraint

otConnectorEnd

otConnectorTag

otConstraint

otCustomProperty

otDatatype

otDiagram

otDiagramLink

otDiagramObject

otEffort

otElement

otEventProperties

otEventProperty

otFile

otIssue

otMailInterface

(c) Sparx Systems 2018 Page 105 of 885

User Guide - Automation 26 July, 2018

otMethod

otMethodConstraint

otMethodTag

otMetric

otModel

otNone

otPackage

otParameter

otParamTag

otPartition

otProject

otProjectIssues

otProjectResource

otProperties

otProperty

otPropertyType

otReference

otRepository

otRequirement

otResource

otRisk

otRoleTag

otScenario

otScenarioExtension

otScenarioStep

(c) Sparx Systems 2018 Page 106 of 885

User Guide - Automation 26 July, 2018

otStereotype

otSwimlane

otSwimlaneDef

otSwimlanes

otTaggedValue

otTask

otTerm

otTest

otTransition

(c) Sparx Systems 2018 Page 107 of 885

User Guide - Automation 26 July, 2018

PropType

The PropType enumeration gives the automationprogrammer an indication of what sort of data is going to bestored by this property.

Enum Values

Value Meaning

ptArray An array containing values of any type.

ptBoolean True or False.

ptEnum A string being an entry in the semi-colonseparated list specified in the validationfield of the Property.

ptFloatingPoint

4 or 8 byte floating point value.

ptInteger 16-bit or 32-bit signed integer.

ptString Unicode string.

(c) Sparx Systems 2018 Page 108 of 885

User Guide - Automation 26 July, 2018

ReloadType

The ReloadType enumeration represents values returnedfrom the GetReloadItem and PeekReloadItem methods ofthe ModelWatcher Class. It has four possible values, whichdefine the type of change that was made to a model.

Enum Values

Value Meaning

rtElement The Item parameter represents aparticular element that must be reloaded.

rtEntireModel

Entire model must be reloaded to ensurethat all changes are reloaded.

rtNone No change in the model.

rtPackage The Item parameter represents aparticular Package that must be reloaded.

(c) Sparx Systems 2018 Page 109 of 885

User Guide - Automation 26 July, 2018

ScenarioDiagramType

The ScenarioDiagramType enumeration provides theseenumeration values to theProject.GenerateDiagramFromScenario() method. Theyspecify the type of diagram to generate.

Enum Values

Value Meaning

sdActivity Generate an Activity diagram.

sdActivityWithAction

Generate an Activity diagram with anAction.

sdActivityWithActionPin

Generate an Activity diagram with anActionPin.

sdActivityWithActivityParameter

Generate an Activity diagram with anActivityParameter.

sdRobustness Generate a Robustness diagram.

sdRuleFlow Generate a RuleFlow diagram.

(c) Sparx Systems 2018 Page 110 of 885

User Guide - Automation 26 July, 2018

sdSequence Generate a Sequence diagram.

sdState Generate a StateMachine diagram.

(c) Sparx Systems 2018 Page 111 of 885

User Guide - Automation 26 July, 2018

ScenarioStepType

The ScenarioStepType enumeration is used to identify thesteps of a scenario, and the entity performing the step.

Enum Values

Value Meaning

stActor Identify that the step is an actionperformed by an actor.

stSystem Identify that the step is an actionperformed by the system.

(c) Sparx Systems 2018 Page 112 of 885

User Guide - Automation 26 July, 2018

ScenarioTestType

The ScenarioTestType enumeration provides theseenumeration values to theProject.GenerateTestFromScenario() method, to specify thetype of test to generate.

Enum Values

Value Meaning

stHorizontalTestSuite

Generate a horizontal Test Suite diagram.

stVerticalTestSuite

Generate a vertical Test Suite diagram.

stExternal Generate an external Test Case element.

stInternal Generate an internal test.

(c) Sparx Systems 2018 Page 113 of 885

User Guide - Automation 26 July, 2018

XMIType

These enumeration values are used in theProject.ExportPackageXMI() andProject.ExportPackageXMIEx() methods, to specify theXMI export type.

xmiEADefault = 0·

xmiRoseDefault = 1·

xmiEA10 = 2·

xmiEA11 = 3·

xmiEA12 = 4·

xmiRose10 = 5·

xmiRose11 = 6·

xmiRose12 = 7·

xmiMOF13 = 8·

xmiMOF14 = 9·

xmiEA20 = 10·

xmiEA21 = 11·

xmiEA211 = 12·

xmiEA212 = 13·

xmiEA22 = 14·

xmiEA23 = 15·

xmiEA24 = 16·

xmiEA241 = 17·

xmiEA242 = 18·

(c) Sparx Systems 2018 Page 114 of 885

User Guide - Automation 26 July, 2018

xmiEcore = 19·

xmiBPMN20 = 20·

xmiXPDL22 = 21·

xmiEA251 = 22·

xmiARCGIS = 23·

(c) Sparx Systems 2018 Page 115 of 885

User Guide - Automation 26 July, 2018

Repository Package

The Repository Package contains the high level systemobjects and the entry point into the model itself, using theModels collection and the other system level collections.

This diagram shows the collections of the Repositoryinterface. Association Target roles correspond to membervariable names in the Repository interface. The associatedClasses represent the object type used in each collection.

(c) Sparx Systems 2018 Page 116 of 885

User Guide - Automation 26 July, 2018

Author Class

An Author object represents a named model author. Authorscan be accessed using the Repository Authors collection.

Associated table in .EAP file

t_authors

Author Attributes

Attribute Remarks

Name StringNotes: Read/WriteThe Author name.

Notes StringNotes: Read/WriteNotes about the author.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced through

(c) Sparx Systems 2018 Page 117 of 885

User Guide - Automation 26 July, 2018

a Dispatch interface.

Roles StringNotes: Read/WriteRoles the author might play in thisproject.

Author Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update () BooleanNotes: Updates the current Author objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 118 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 119 of 885

User Guide - Automation 26 July, 2018

Client Class

A Client represents one or more people or organizationsrelated to the project. Clients can be accessed using theRepository Clients collection.

Associated table in .EAP file

t_clients

Client Attributes

Attribute Remarks

EMail StringNotes: Read/WriteThe client's email address.

Fax StringNotes: Read/WriteThe client's fax number.

Mobile StringNotes: Read/Write

(c) Sparx Systems 2018 Page 120 of 885

User Guide - Automation 26 July, 2018

The client's mobile phone number, ifavailable.

Name StringNotes: Read/WriteThe client's name.

Notes StringNotes: Read/WriteNotes about the client.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced throughthe Dispatch interface.

Organization StringNotes: Read/WriteThe client's associated organization.

Phone1 StringNotes: Read/WriteThe client's main phone number.

Phone2 StringNotes: Read/WriteThe client's second phone number.

(c) Sparx Systems 2018 Page 121 of 885

User Guide - Automation 26 July, 2018

Roles StringNotes: Read/WriteRoles this client might play in the project.

Client Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current Client objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 122 of 885

User Guide - Automation 26 July, 2018

Collection Class

Collection is the main collection Class used by all elementswithin the Automation Interface. It contains methods toiterate through the collection, refresh the collection anddelete an item from the collection.

It is important to realize that when AddNew is called, theitem is not automatically added to the current collection.The typical steps are:

Call AddNew to add a new item·

Modify the item as required·

Call Update on the item to save it to the database·

Call Refresh on the collection to include it in the current·

set

Delete is the same; until Refresh is called, the collection stillcontains a reference to the deleted item, which should not becalled.

Each method can be used to iterate through the collectionfor languages that support this type of construct.

Collection Attributes

Attribute Remarks

Count ShortNotes: Read only

(c) Sparx Systems 2018 Page 123 of 885

User Guide - Automation 26 July, 2018

The number of objects referenced by thislist.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Collection Methods

Method Remarks

AddNew(string Name,string Type)

ObjectNotes: Adds a new item to the currentcollection.The interface is the same for allcollections; you must provide a Nameand Type argument. What thesearguments are used for depends on theactual collection being accessed. Forexample, when adding a new element tothe Elements collection, the Type stringcan be either a basic UML element typeor a fully qualified element type(stereotype) defined by a profile, such asSysML::Requirement, differentiating it

(c) Sparx Systems 2018 Page 124 of 885

User Guide - Automation 26 July, 2018

from a standard requirement.Also note that you must call Update() onthe returned object to complete theAddNew. If Update() is not called theobject is left in an indeterminate state.Parameters:

Name: String·

Type: String (up to 30 characters long)·

Delete(shortindex)

VoidNotes: Deletes the item at the selectedreference.Parameters:

index: Short·

DeleteAt(short index,booleanRefresh)

VoidNotes: Deletes the item at the selectedindex. The second parameter is currentlyunused.Parameters:

index: Short·

Refresh: Boolean·

GetAt(shortindex)

ObjectNotes: Retrieves the array object using anumerical index. If the index is out ofbounds, an error occurs.

(c) Sparx Systems 2018 Page 125 of 885

User Guide - Automation 26 July, 2018

Parameters:index: Short·

GetByName(string Name)

ObjectNotes: Gets an item in the currentcollection by name. Supported for Model,Package, Element, Diagram and elementTaggedValue collections.If the collection does not contain anyitems (or, for the Tagged Valuecollection, if the collection contains itemsbut the method cannot locate an objectwith the specified name) the methodreturns a null value. For other collections,if the method is unable to find an objectwith the specified name, it raises anexception.Parameters:

Name: String·

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Refresh() VoidNotes: Refreshes the collection byre-querying the model and reloading the

(c) Sparx Systems 2018 Page 126 of 885

User Guide - Automation 26 July, 2018

collection. Should be called after addinga new item or after deleting an item.

Update() BooleanNotes: Updates the current Collectionobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 127 of 885

User Guide - Automation 26 July, 2018

The AddNew Function

The AddNew() function is used widely across the API toadd new objects to a Collection. In all cases you mustprovide a Name and Type argument, but what thesearguments are used for depends on the actual collectionbeing accessed. For example, when adding a new element tothe Elements collection, the 'Type' string can be either abasic UML element type or a fully qualified element type(stereotype) defined by a profile, such asSysML::Requirement differentiated from a standardrequirement.

AddNew Attribute Arguments

This table provides guidance in specifying the AddNewarguments for each of the object attributes.

Attribute Arguments

AttributeConstraints

Name - The name of the constraint.Type - The constraint type

Attributes Name - The name of the attribute.Type - The attribute type.

AttributesEx Name - The name of the attribute.Type - The attribute type.

(c) Sparx Systems 2018 Page 128 of 885

User Guide - Automation 26 July, 2018

AttributeTags Name - The fully-qualified name, or plaintext.Type - The value of the Tagged Value.

Authors Name - The author name.Type - The author role.

Clients Name - The client name.Type - The client role.

ConnectorConstraints

Name - The name of the constraint.Type - The constraint type.

ConnectorConveyedItems

Name - The GUID of an element.Type - Not used.Note: This does not return an object.

Connectors Name - The name of the connector.Type - The connector type (for example'Realization').

ConnectorTags

Name - The fully-qualified name, or plaintext.Type - The value of the Tagged Value.

Constraints Name - The name of the constraint.

(c) Sparx Systems 2018 Page 129 of 885

User Guide - Automation 26 July, 2018

Type - The constraint type.

ConstraintsEx

Name - The name of the constraint.Type - The constraint type.

CustomProperties

You cannot create these.

DataTypes Name - The datatype name.Type - The datatype type.

DiagramLinks

Name - Not used.Type - The style string (such as'l=200;r=400;t=200;b=600;')(You might prefer to leave the Typeempty and use the Functions on thisinterface for size, colors and so on).

DiagramObjects

Name - This can either be an emptystring, or it can specify the initial Left,Right, Top and Bottom values for thenew DiagramObject. For example:

diagram.DiagramObjects.AddNew("l=200;r=400;t=200;b=600;", "")Note: Top and Bottom values should bespecified here as positive numbers, butwill be set in the repository as negative

(c) Sparx Systems 2018 Page 130 of 885

User Guide - Automation 26 July, 2018

values.Type - Unused.

Diagrams Name - The name of the diagram.Type - This can be either a standard UMLmetaclass type (such as 'Class' or'UseCase') or a fully-qualified metatypedefined by an MDG Technology (such as'BPMN2.0::BusinessProcess' or'SysML1.4::Block').

Efforts Name - The name of the effort.Type - The effort type.

Elements Name - The name of the new element. Ifthe repository has an auto-name counterdefined for the element type beingcreated, pass an empty string to use theauto-name counter instead.Type - Can be either a standard UMLmetaclass type (such as 'Class' or'UseCase') or a fully-qualified metatypedefined by an MDG Technology (such as'BPMN2.0::BusinessProcess' or'SysML1.4::Block').

Files Name - The full pathname of the file.Type - The file type (such as 'Local File'

(c) Sparx Systems 2018 Page 131 of 885

User Guide - Automation 26 July, 2018

or 'Web Address').

Issues Name - The name of the issue.Type - The problem type, (such as 'Issue'or 'Defect')

MethodPostConditions

Name - The name of the constraint.Type - The constraint type

MethodPreconditions

Name - The name of the constraint.Type - The constraint type.

Methods Name - The name of the method.Type - The return value of the method.

MethodsEx Name - The name of the method.Type - The return value of the method.

MethodTags Name - The fully-qualified name, or plaintext.Type - The value of the Tagged Value.

Metrics Name - The name of the metric.Type - The metric type.

Models Name - The name of the model.Type - Unused.

(c) Sparx Systems 2018 Page 132 of 885

User Guide - Automation 26 July, 2018

Packages Name - The name of the Package.Type - Unused.

Parameters Name - The parameter name.Type - The parameter type.

ParamTags Name - The fully-qualified name or plaintext.Type - The value of the Tagged Value.

Partitions Name - The partition name.Type - The partition note.

ProjectIssues Name - The name of the issue.Type - The issue type (such as 'Request','Defect', or 'Release')

ProjectResources

Name - The resource name.Type - The resource role.

ProjectRole Name - The role name.Type - Not used.

PropertyTypes

Name - The tag name.Type - The description (limited to 50characters).

(c) Sparx Systems 2018 Page 133 of 885

User Guide - Automation 26 July, 2018

Requirements Name - The name of the requirement.Type - The requirement type.

RequirementsEx

Name - The name of the requirement.Type - The requirement type.

Resources Name - The resource name.Type - The resource role.

Risks Name - The name of the risk.Type - The risk type.

ScenarioExtension

Name - The extension name.Type - The scenario type

ScenarioStep Name - The step name.Type - The ScenarioStep type value.

Scenarios Name - The name of the scenario.Type - The scenario type.

Stereotypes Name - The stereotype name.Type - The element this applies to.Note: You can only support multipleelements from within a Profile.

Tasks Name - The task name.

(c) Sparx Systems 2018 Page 134 of 885

User Guide - Automation 26 July, 2018

Type - The task type.

TemplateBindings

Name - The formal name of the binding.Type - The actual name of the binding orelement GUID.

TemplateParameters

Name - The parameter name.Type - The parameter type

Terms Name - The term name.Type - The term type.

Tests Name - The name of the test.Type - The test type.

Transitions Name - The transition name.Type - The transition value.

(c) Sparx Systems 2018 Page 135 of 885

User Guide - Automation 26 July, 2018

Datatype Class

A Datatype is a named type that can be associated withattribute or method types. It typically is related to eithercode engineering or database modeling. Datatypes alsoindicate which language or database system they relate to.Datatypes can be accessed using the Repository Datatypescollection.

Associated table in .EAP file

t_datatypes

Datatype Attributes

Attribute Remarks

DatatypeID LongNotes: Read/WriteThe instance ID for this datatype withinthe current model; this is systemmaintained.

DefaultLen LongNotes: Read/Write

(c) Sparx Systems 2018 Page 136 of 885

User Guide - Automation 26 July, 2018

The default length (DDL only).

DefaultPrec LongNotes: Read/WriteThe default precision (DDL only).

DefaultScale LongNotes: Read/WriteThe default scale (DDL only).

GenericType StringNotes: Read/WriteThe associated generic type for this datatype.

HasLength StringNotes: Read/WriteIndicates whether the datatype has alength component.

MaxLen LongNotes: Read/WriteThe maximum length (DDL only).

MaxPrec LongNotes: Read/WriteThe maximum precision (DDL only).

(c) Sparx Systems 2018 Page 137 of 885

User Guide - Automation 26 July, 2018

MaxScale LongNotes: Read/WriteThe maximum scale (DDL only).

Name StringNotes: Read/WriteThe datatype name (such as integer). Thisappears in the related drop-down datatypelists where appropriate.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Product StringNotes: Read/WriteThe datatype product, such as Java, C++or Oracle.

Size LongNotes: Read/WriteThe datatype size.

Type StringNotes: Read/Write

(c) Sparx Systems 2018 Page 138 of 885

User Guide - Automation 26 July, 2018

The type can be DDL for databasedatatypes or Code for language datatypes.

UserDefined LongNotes: Read/WriteIndicates if the datatype is a user definedtype or system generated.Datatypes distributed with EnterpriseArchitect are all system generated.Datatypes created in the 'Datatype' dialogare marked 1 (True).

Datatype Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current Datatypeobject after modification or appending anew item.

(c) Sparx Systems 2018 Page 139 of 885

User Guide - Automation 26 July, 2018

If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 140 of 885

User Guide - Automation 26 July, 2018

EventProperties Class

An EventProperties object is passed to BroadcastFunctionsto facilitate parameter passing.

EventProperties Attributes

Attribute Remarks

Count LongNotes: Read onlyThe number of parameters being passedto this broadcast event.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

EventProperties Methods

Method Remarks

(c) Sparx Systems 2018 Page 141 of 885

User Guide - Automation 26 July, 2018

Get(objectIndex)

EventProperty ClassNotes: Read onlyReturns an EventProperty in the list,raising an error if Index is out of range.Parameters:

Index: Variant - can either be a number·

representing a zero-based index intothe array, or a string representing thename of the EventProperty: forexample, Props.Get(3) orProps.Get("ObjectID")

(c) Sparx Systems 2018 Page 142 of 885

User Guide - Automation 26 July, 2018

EventProperty Class

EventProperty objects are always part of an EventPropertiescollection, and are passed to Add-In methods responding tobroadcast events.

EventProperty Attributes

Attribute Remarks

Description StringNotes: An explanation of what thisproperty represents.

Name StringNotes: A string distinguishing thisproperty from others in the list.

ObjectType ObjectTypeNotes: Distinguishes objects referencedthrough a Dispatch interface.

Value VariantNotes: A string, number or objectreference representing the property value.

(c) Sparx Systems 2018 Page 143 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 144 of 885

User Guide - Automation 26 July, 2018

ModelWatcher Class

The ModelWatcher object enables an automation client totrack changes in a particular model.

ModelWatcher Attributes

Attribute Remarks

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

ModelWatcher Methods

Methods Remarks

GetReloadItem (objectItem)

ReloadTypeNotes: The object that must be reloadedin order to see all changes is returnedthrough the Item parameter. If there areno changes or the entire model must bereloaded, this value is returned as null

(c) Sparx Systems 2018 Page 145 of 885

User Guide - Automation 26 July, 2018

(C#) or Nothing (VB).Calling this method clears the records sothat the next time it is called the returnvalues refer only to new changes.Returns a value from the ReloadTypeenumeration that specifies which type ofchange, if any, has occurred.Parameters:

Item: Object·

PeekReloadItem

ReloadTypeNotes: This method behaves identicallyto 'GetReloadItem()' but does not clearthe change record.

Notes

After your model has been loaded, you only create the·

ModelWatcher once; if you reload the model, or loadanother model, the created ModelWatcher is still valid

(c) Sparx Systems 2018 Page 146 of 885

User Guide - Automation 26 July, 2018

Package Class

A Package object corresponds to a Package element in theEnterprise Architect Project Browser. Packages can beaccessed either through the Repository Models collection (aModel is a special form of Package) or through the PackagePackages collection.

Note that a Package has an Element object as an attribute;this corresponds to an Enterprise Architect Package elementin the t_object table and is used to associate additionalinformation (such as scenarios and constraints) with thelogical Package.

To set additional information for a Package, reference theElement object directly. Also note that if you add a Packageto a diagram, you should add an instance of the element (notthe Package itself) to the DiagramObject Class for adiagram.

Associated table in .EAP file

t_package

Package Attributes

Attribute Remarks

(c) Sparx Systems 2018 Page 147 of 885

User Guide - Automation 26 July, 2018

Alias StringNotes: Read onlyAlias

BatchLoad LongNotes: Read/WriteFlag to indicate that the Package is batchloaded during batch import fromcontrolled Packages.Not currently used.

BatchSave LongNotes: Read/WriteBoolean value to indicate whether thePackage is included in the batch XMIexport list or not.

CodePath StringNotes: Read/WriteThe path where associated source code isfound.Not currently used.

Connectors CollectionNotes: Read onlyThe collection of connectors.

(c) Sparx Systems 2018 Page 148 of 885

User Guide - Automation 26 July, 2018

Created DateNotes: Read/WriteDate the Package was created.

Diagrams CollectionNotes: Read onlyA collection of diagrams contained in thisPackage.

Element ElementNotes: Read onlyThe associated element object; use toget/set common information such asStereotype, Complexity, Alias, Author,Constraints, Tagged Values andScenarios.

Elements CollectionNotes: Read onlyA collection of elements that belong tothis Package.

Flags StringNotes: Read/WriteExtended information about the Package.

(c) Sparx Systems 2018 Page 149 of 885

User Guide - Automation 26 July, 2018

IsControlled BooleanNotes: Read/WriteIndicates if the Package has been markedas Controlled.

IsModel BooleanNotes: Read onlyIndicates if the Package is a model or aPackage.

IsNamespace BooleanNotes: Read/WriteTrue indicates that 'Package is aNamespace root'.Use 0 and 1 to set False and True.

IsProtected BooleanNotes: Read/WriteIndicates if the Package has been markedas 'Protected'.

IsVersionControlled

BooleanNotes: Read onlyIndicates whether or not this Package isunder version control.

LastLoadDat Date

(c) Sparx Systems 2018 Page 150 of 885

User Guide - Automation 26 July, 2018

e Notes: Read/WriteThe date XML was last loaded for thePackage.

LastSaveDate DateNotes: Read/WriteThe date XML was last saved from thePackage.

LogXML BooleanNotes: Read/WriteIndicates if XMI export information is tobe logged.

Modified DateNotes: Read/WriteDate the Package was last modified.

Name StringNotes: Read/WriteThe name of the Package.

Notes StringNotes: Read/WriteNotes about this Package.

ObjectType ObjectType

(c) Sparx Systems 2018 Page 151 of 885

User Guide - Automation 26 July, 2018

Notes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Owner StringNotes: Read/Write.The Package owner when usingcontrolled Packages.

PackageGUID

VariantNotes: Read onlyThe global Package ID; valid acrossmodels.

PackageID LongNotes: Read onlyThe local Package ID number.Valid only in this model file.

Packages CollectionNotes: Read onlyA collection of contained Packages thatcan be walked through.

ParentID LongNotes: Read/WriteThe ID of the Package that is the parent

(c) Sparx Systems 2018 Page 152 of 885

User Guide - Automation 26 July, 2018

of this one.0 indicates that this Package is a model(that is, it has no parent).

TreePos LongNotes: Read/WriteThe relative position in the tree comparedto other Packages (use to sort Packages).

UMLVersion StringNotes: Read/WriteThe UML version for XMI exportpurposes.

UseDTD BooleanNotes: Read/WriteIndicates if a DTD is to be used whenexporting XMI.

Version StringNotes: Read/WriteThe version of the Package.

XMLPath StringNotes: Read/WriteThe path to which the XML is savedwhen using controlled Packages.

(c) Sparx Systems 2018 Page 153 of 885

User Guide - Automation 26 July, 2018

Package Methods

Method Remarks

ApplyGroupLock (stringaGroupName)

BooleanNotes: Applies a group lock to thePackage object, for the specified group,on behalf of the current user. UserSecurity applies to the use of thisfunction; if the user does not havepermission to apply or release locks onelements, diagrams and Packages, theoperation will fail.Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use GetLastError() toretrieve error information.Parameters:

aGroupName: String - The name of the·

security group for which to apply thelock

ApplyGroupLockRecursive (string

BooleanNotes: Applies a group lock to thePackage object, object, and all of the

(c) Sparx Systems 2018 Page 154 of 885

User Guide - Automation 26 July, 2018

aGroupName, booleanIncludeElements, booleanIncludeDiagrams, booleanIncludeSubPackages)

Package, diagrams and elementscontained within that Package, for thespecified group, on behalf of the currentuser. User Security applies to the use ofthis function; if the user does not havepermission to apply or release locks onelements, diagrams and Packages, theoperation will fail.Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use 'GetLastError()' toretrieve error information.Parameters

aGroupName: String - The name of the·

security group for which to apply thelockIncludeElements: Boolean -·

Recursively apply group lock to childelementsIncludeDiagrams: Boolean -·

Recursively apply group lock to childdiagramsIncludeSubPackages: Boolean -·

Recursively apply group lock to childPackages

ApplyUserLock ()

BooleanNotes: Applies a user lock to the Package

(c) Sparx Systems 2018 Page 155 of 885

User Guide - Automation 26 July, 2018

object for the current user. User Securityapplies to the use of this function; if theuser does not have permission to apply orrelease locks on elements, diagrams andPackages, the operation will fail.Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use 'GetLastError()' toretrieve error information.

ApplyUserLockRecursive(booleanIncludeElements,booleanIncludeDiagrams,booleanIncludeSubPackages)

BooleanNotes: Applies user locks to the Packageobject, and all of the Packages, diagramsand elements contained within thatPackage. User Security applies to the useof this function; if the user does not havepermission to apply or release locks onelements, diagrams and Packages, theoperation will fail.Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use GetLastError() toretrieve error information.Parameters

IncludeElements: Boolean -·

Recursively apply user lock to childelementsIncludeDiagrams: Boolean -·

Recursively apply user lock to child

(c) Sparx Systems 2018 Page 156 of 885

User Guide - Automation 26 July, 2018

diagramsIncludeSubPackages: Boolean -·

Recursively apply user lock to childPackages

Clone LDISPATCHNotes: Inserts a copy of the Package intothe same parent as the original Package.Returns the newly-created Package.

FindObject(stringDottedID)

LPDISPATCHNotes: Returns a Package, element,attribute or operation matching theparameter DottedID.If the DottedID is not found, an error isreturned: Can't find matching object.Parameters

DottedID: String - Is in the form·

'object.object.object' where object isreplaced by the name of a Package,element attribute or operation;examples includeMyNamespace.Class1,CStudent.m_Name,MathClass.DoubleIt(int)

GetLastError()

StringNotes: Returns a string value describing

(c) Sparx Systems 2018 Page 157 of 885

User Guide - Automation 26 July, 2018

the most recent error that occurred inrelation to this object.

ReleaseUserLock ()

BooleanNotes: Removes an existing User orGroup lock from the Package object.User Security applies to the use of thisfunction; if the user does not havepermission to apply or release locks onelements, diagrams and Packages, theoperation will fail.Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use GetLastError() toretrieve error information.

ReleaseUserLockRecursive ()

BooleanNotes: Releases user locks and grouplocks from the Package object, and all ofthe Packages, diagrams and elementscontained within that Package. UserSecurity applies to the use of thisfunction; if the user does not havepermission to apply or release locks onelements, diagrams and Packages, theoperation will fail.Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use GetLastError() to

(c) Sparx Systems 2018 Page 158 of 885

User Guide - Automation 26 July, 2018

retrieve error information.

SetReadOnly(booleanReadOnly,booleanIncludeSubPkgs)

VoidNotes: Sets a Package Flag to mark aPackage as ReadOnly=1.If Project Security is enabled, the usermust have 'Configure Packages'permission to use this method.Throws an exception if the operation failsdue to the user not having 'ConfigurePackages' permission; use'GetLastError()' to retrieve errorinformation.Parameters

ReadOnly: Boolean - Sets or clears the·

Read Only flag on the Package(s); if: False, any Read Onlyflag is removed from the Package True, a Read Only flagis applied to the Package

IncludeSubPkgs: Boolean - Indicates·

whether to set/reset the Read Only flagon just the object Package, or on theobject Package and all of the nestedsub-Packages that it contains; if:

False, only the flag onthe object Package is set or cleared True, flags are set (or

(c) Sparx Systems 2018 Page 159 of 885

User Guide - Automation 26 July, 2018

cleared, according to the ReadOnlyparameter) for the object Package plus allof the nested sub-Packages that itcontainsWhen working with version controlledPackages, the Read Only flag can beapplied to Packages whether they arechecked-in or checked-out.User Security applies to setting this flag -if you are prevented from editing thePackage, you are also prevented fromsetting the flag.

Update () BooleanNotes: Updates the current Packageobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.Note that a Package object also has anelement component that must be takeninto account; the Package object containsinformation about the Package attributessuch as hierarchy or contents.The element attribute containsinformation about, for example,Stereotypes, Constraints or Files - all the

(c) Sparx Systems 2018 Page 160 of 885

User Guide - Automation 26 July, 2018

attributes of a typical element.

VersionControlAdd (stringConfigGuid,stringXMLFile,stringComment,booleanKeepCheckedOut)

VoidNotes: Places the Package under versioncontrol, using the specified VersionControl Configuration and the specifiedXMI filename.Throws an exception if the operationfails; use GetLastError() to retrieve errorinformation.It is recommended that the Package besaved using Update() before callingVersionControlAdd(), so that anyoutstanding changes are not lost.Parameters

ConfigGuid: String - Name·

corresponding to the Unique ID of theversion control configuration to useXMLFile: String - Name of the XML·

file to use for this Package; thisfilename is relative to the WorkingCopy folder specified for the ConfigComment: String - Log message that is·

added to the version controlled file'shistory (where applicable)KeepCheckedOut: Boolean - Specify·

True to add to version control and keepthe Package checked-out

(c) Sparx Systems 2018 Page 161 of 885

User Guide - Automation 26 July, 2018

VersionControlCheckin(stringComment)

VoidNotes: Perform checkin of the versioncontrolled Package (also seeVersionControlCheckinEx).Throws an exception if the operationfails; use GetLastError() to retrieve errorinformation.Parameters

Comment: String - Log message that is·

added to the version controlled file'shistory (where applicable)

VersionControlCheckinEx(stringComment,booleanPreserveCrossPkgRefs)

VoidNotes: Perform checkin of the versioncontrolled Package.Throws an exception if the operationfails; use GetLastError() to retrieve errorinformation.Parameters

Comment: String - Log message that is·

added to the version controlled file'shistory (where applicable)PreserveCrossPkgRefs: Boolean - Flag·

to indicate whether to preserve ordiscard pre-existing Cross PackageReferences when checking-in; thisparameter overrides the setting in the

(c) Sparx Systems 2018 Page 162 of 885

User Guide - Automation 26 July, 2018

'Preferences' dialog, 'XMLSpecifications' pageUnsatisfied cross-Package referencesare preserved or discarded according tothis setting, without prompting theuser; see Learn more

VersionControlCheckout(stringComment)

VoidNotes: Perform checkout of the versioncontrolled Package.Throws an exception if the operationfails; use GetLastError() to retrieve errorinformation.Parameters:

Comment: String - Log message that is·

added to the version controlled file'shistory (where applicable)

When working in an environment thatuses a Private Model deployment andyour model contains a significant numberof cross-Package references, it isrecommended that you invoke theRepository.ScanXMIAndReconcile()method from time to time, following there-importation of controlled Packages -for example, after usingPackage.VersionControlGetLatest() toupdate a number of Packages, or afterperforming a number of Package

(c) Sparx Systems 2018 Page 163 of 885

User Guide - Automation 26 July, 2018

check-outs.

VersionControlGetLatest(booleanForceImport)

VoidNotes: Updates the local working copy ofthe Package file associated with theobject Package, before re-importing thePackage data from the Package file.Parameters:

ForceImport: Boolean - Used if the·

Package data in the model is found tobe up-to-date with respect to theversion controlled Package file; if: - False, the Package data that existsin the model is accepted as beingup-to-date and no attempt is made to re-import datafrom the Package file - True, the system re-imports thePackage from the Package fileregardless

See also the version control menu option'Get Latest'.When working in an environment thatuses a Private Model deployment andyour model contains a significant numberof cross-Package references, it isrecommended that you invoke the'Repository.ScanXMIAndReconcile()'method from time to time, following the

(c) Sparx Systems 2018 Page 164 of 885

User Guide - Automation 26 July, 2018

re-importation of controlled Packages -for example, after using'Package.VersionControlGetLatest()' toupdate a number of Packages, or afterperforming a number of Packagecheck-outs.

VersionControlGetStatus()

LongNotes: Returns the version control statusof the Package, as recorded in the currentproject database.Throws an exception if the operationfails; use GetLastError() to retrieve errorinformation.Return value maps to this enumeratedtype: enum EnumCheckOutStatus { csUncontrolled = 0, csCheckedIn, csCheckedOutToThisUser, csReadOnlyVersion, csCheckedOutToAnotherUser, csOfflineCheckedIn, csCheckedOutOfflineByUser, csCheckedOutOfflineByOther, csDeleted,

(c) Sparx Systems 2018 Page 165 of 885

User Guide - Automation 26 July, 2018

};csUncontrolled - Either unable to·

communicate with the version controlprovider associated with the Package,or the Package file is unknown to theprovidercsCheckedIn - The Package is not·

checked-out to anybody in the currentproject databasecsCheckedOutToThisUser - The·

Package is marked as checked-out tothe current user, in the current projectdatabasecsReadOnlyVersion - The Package is·

marked as read-only; an earlier revisionof the Packagehas been retrieved fromversion controlcsCheckedOutToAnotherUser - The·

Package is marked as checked-out inthe current project database, by a userother than the current usercsOfflineCheckedIn - The Package is·

not checked-out to anybody in thecurrent project database; however, theversion control configurationassociated with the Package was unableto connect to the VC servercsCheckedOutOfflineByUser - The·

Package was 'checked out' in this

(c) Sparx Systems 2018 Page 166 of 885

User Guide - Automation 26 July, 2018

database, by this user, whilstdisconnected from version controlcsCheckedOutOfflineByOther - The·

Package was checked out in this projectdatabase, by another user, whilstdisconnected from version controlcsDeleted - The Package file has been·

deleted from version control

VersionControlPutLatest(stringCheckInComment)

VoidNotes: Perform a checkin of the versioncontrolled Package, whilst keeping thePackage checked-out.Throws an exception if the operationfails; use GetLastError() to retrieve errorinformation.When a Package that was previouslymarked as Checked Out Offline, issuccessfully 'Put' (checkedin) to versioncontrol, that Package's flags are updatedto clear the Checked Out Offlineindicator.Parameters:

Comment: String - Log message added·

to the version controlled file's history(where applicable)

VersionContr Void

(c) Sparx Systems 2018 Page 167 of 885

User Guide - Automation 26 July, 2018

olRemove () Notes: Removes version control from thePackage.Throws an exception if the operationfails; use 'GetLastError()' to retrieve errorinformation.

VersionControlResynchPkgStatus(booleanClearSettings)

Notes: Synchronizes the version controlstatus of the single object Packagerecorded in your current model with thePackage status reported by your versioncontrol provider.Parameters:

ClearSettings: Boolean - used if the·

Package file associated with thespecified Package is reported by theversion control provider asuncontrolled; if ClearSettings is:

True, the versioncontrol settings are cleared from thePackage False, the versioncontrol settings remain unchanged

(c) Sparx Systems 2018 Page 168 of 885

User Guide - Automation 26 July, 2018

ProjectIssues Class

A ProjectIssue is a system-level Issue that indicates aproblem or risk associated with the system as a whole.ProjectIssues can be accessed using the Repository Issuescollection.

Associated table in .EAP file

t_issues

ProjectIssues Attributes

Attribute Remarks

Category StringNotes: Read/WriteThe category this issue belongs to.

Date DateNotes: Read/WriteThe date the issue item was created.

DateResolved

Date

(c) Sparx Systems 2018 Page 169 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe date the issue was resolved.

Name StringNotes: Read/WriteThe issue name (that is, the issue itself).

IssueID LongNotes: Read onlyThe ID of this issue.

Notes StringNotes: Read/WriteThe associated description of the issue.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Owner StringNotes: Read/WriteThe owner of the issue.

Priority StringNotes: Read/WriteThe issue priority - Low, Medium or

(c) Sparx Systems 2018 Page 170 of 885

User Guide - Automation 26 July, 2018

High.

Resolution StringNotes: Read/WriteA description of the resolution.

Resolver StringNotes: Read/WriteThe name of the person resolving theissue.

Severity StringNotes: Read/WriteThe issue severity - Low, Medium orHigh.

Status StringNotes: Read/WriteThe current status of the issue.

ProjectIssues Methods

Method Remarks

(c) Sparx Systems 2018 Page 171 of 885

User Guide - Automation 26 July, 2018

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current Issue objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 172 of 885

User Guide - Automation 26 July, 2018

ProjectResource Class

A Project Resource is a named person who is available towork on the current project in any capacity.ProjectResources can be accessed using the RepositoryResources collection.

Associated table in .EAP file

t_resources

ProjectResource Attributes

Attribute Remarks

Email StringNotes: The resource's email address.

Fax StringNotes: The resource's fax number.

Mobile VariantNotes: The resource's mobile number, ifavailable.

(c) Sparx Systems 2018 Page 173 of 885

User Guide - Automation 26 July, 2018

Name StringNotes: The name of the resource.

Notes StringNotes: A description of the resource, ifappropriate.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Organization Package Class: StringNotes: The organization the resource isassociated with.

Phone1 VariantNotes: The resource's main telephonenumber.

Phone2 VariantNotes: The resource's alternativetelephone number.

Roles StringNotes: The roles this resource can play inthe current project.

(c) Sparx Systems 2018 Page 174 of 885

User Guide - Automation 26 July, 2018

ProjectResource Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current Resourceobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 175 of 885

User Guide - Automation 26 July, 2018

ProjectRole Class

A ProjectRole object represents a named project role.ProjectRoles can be accessed using the RepositoryProjectRole collection.

Associated table in .EAP file

t_projectroles

ProjectRole Attributes

Attribute Remarks

Description StringNotes: Read/WriteThe project role item description.

Notes StringNotes: Read/WriteNotes about the project role item.

ObjectType ObjectTypeNotes: Read only

(c) Sparx Systems 2018 Page 176 of 885

User Guide - Automation 26 July, 2018

Distinguishes objects referenced througha Dispatch interface.

Role StringNotes: Read/WriteThe project role item name.

ProjectRole Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current ProjectRoleobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 177 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 178 of 885

User Guide - Automation 26 July, 2018

PropertyType Class

A PropertyType object represents a defined property thatcan be applied to UML elements as a Tagged Value.PropertyTypes can be accessed using the RepositoryPropertyTypes collection.

Each PropertyType corresponds to one of the predefinedTagged Values for the model.

Associated table in .EAP file

t_propertytypes

PropertyType Attributes

Attribute Remarks

Description StringNotes: Read/WriteA short description of the property.

Detail StringNotes: Read/WriteConfiguration information for theproperty.

(c) Sparx Systems 2018 Page 179 of 885

User Guide - Automation 26 July, 2018

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Tag StringNotes: Read/WriteThe name of the property (Tag Name).

PropertyType Methods:

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current PropertyTypeobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for more

(c) Sparx Systems 2018 Page 180 of 885

User Guide - Automation 26 July, 2018

information.

(c) Sparx Systems 2018 Page 181 of 885

User Guide - Automation 26 July, 2018

Reference Class

This Interface provides access to the various lookup tableswithin Enterprise Architect. Use the RepositoryGetReferenceList() method to get a handle to a list.

Valid lists are:

Diagram·

Element·

Constraint·

Requirement·

Connector·

Status·

Cardinality·

Effort·

Metric·

Scenario·

Status·

Test·

List:DifficultyType·

List:PriorityType·

List:TestStatusType·

List:ConstStatusType·

Reference Attributes

(c) Sparx Systems 2018 Page 182 of 885

User Guide - Automation 26 July, 2018

Attribute Remarks

Count ShortNotes: A count of items in the list.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Type StringNotes: The list type (for example,DiagramTypes).

Reference Methods

Method Remarks

GetAt(shortIndex)

StringNotes: Get the item at the specified index.Parameters:

Index: Short - The index of the item to·

retrieve from the list

(c) Sparx Systems 2018 Page 183 of 885

User Guide - Automation 26 July, 2018

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Refresh() ShortNotes: Refresh the current list and returnthe count of items.

(c) Sparx Systems 2018 Page 184 of 885

User Guide - Automation 26 July, 2018

Repository Class

The Repository is the main container of all structures suchas models, Packages and elements. You can begin accessingthe model iteratively using the Models collection. TheRepository also has some convenient methods to directlyaccess the structures without having to locate them in thehierarchy first.

Associated table in .EAP file

<none>

Repository Attributes

Attribute Remarks

Authors CollectionNotes: Read onlyThis is the system Authors collectioncontaining 0 or more Author objects,each of which can be associated with, forexample, elements or diagrams as theitem author or owner.Use AddNew(), Delete() and GetAt() to

(c) Sparx Systems 2018 Page 185 of 885

User Guide - Automation 26 July, 2018

manage Authors.

BatchAppend BooleanNotes: Read/WriteSet this property to True when yourautomation client has to rapidly insertmany elements, operations, attributesand/or operation parameters.Set to False when work is complete.This can result in 10- to 20-foldimprovement in adding new elements inbulk.

Clients CollectionNotes: Read onlyA list of Clients associated with theproject. You can modify, delete and addnew Client objects using this collection.

ConnectionString

StringNotes: Read onlyThe filename/connection string of thecurrent Repository.For a connection string, the DBMSrepository type is identified by"DBType=n;" where n is a numbercorresponding to the DBMS type, asshown:

(c) Sparx Systems 2018 Page 186 of 885

User Guide - Automation 26 July, 2018

0 - MYSQL1 - SQLSVR2 - ADOJET3 - ORACLE4 - POSTGRES5 - ASA8 - ACCESS20079 - FIREBIRD

Datatypes CollectionNotes: Read onlyThe Datatypes collection. This contains alist of Datatype objects, each representinga data type definition for either datamodeling or code generation purposes.

EAEdition EAEditionTypesNotes: Read onlyReturns the current level of core licensedfunctionality available.This property returns Corporate whenthe edition is Unified or Ultimate.Use 'EAEditionEx' to identify which ofthese extended editions is available.

EAEditionEx EAEditionTypesNotes: Read only

(c) Sparx Systems 2018 Page 187 of 885

User Guide - Automation 26 July, 2018

Returns the current level of extendedlicensed functionality available (Unifiedor Ultimate).

EnableCache BooleanNotes: Read/WriteAn optimization for pre-loading Packageobjects when dealing with large sets ofautomation objects.

EnableUIUpdates

BooleanNotes: Read/WriteSet this property to False to improve theperformance of changes to the model; forexample, bulk addition of elements to aPackage. To reveal changes to the user,call 'Repository.RefreshModelView()'.

FlagUpdate BooleanNotes: Read/WriteInstructs Enterprise Architect to updatethe Repository with the LastUpdatevalue.

InstanceGUID

StringNotes: Read onlyThe identifier string identifying theEnterprise Architect runtime session.

(c) Sparx Systems 2018 Page 188 of 885

User Guide - Automation 26 July, 2018

IsSecurityEnabled

BooleanNotes: Read onlyIndicates whether User Security isenabled for the current repository.

Issues CollectionNotes: Read onlyThe System Issues list. ContainsProjectIssues objects, each detailing aparticular issue as it relates to the projectas a whole.

LastUpdate StringNotes: Read onlyThe identifier string identifying theEnterprise Architect runtime session andthe timestamp for when it was set.

LibraryVersion

LongNotes: Read onlyThe build number of the EnterpriseArchitect runtime.

Models Collection of type PackageNotes: Read onlyModels are of type Package and belong toa collection of Packages. This is the top

(c) Sparx Systems 2018 Page 189 of 885

User Guide - Automation 26 July, 2018

level entry point to an EnterpriseArchitect project file. Each model is aroot node in the Project Browser and cancontain items such as Views andPackages.A model is a special form of a Package; ithas a ParentID of 0. By iterating throughall models, you can access all theelements within the project hierarchy.You can also use the AddNew() functionto create a new model. A model can bedeleted, but remember that everythingcontained in the model is deleted as well.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced throughthe Dispatch interface.

ProjectGUID StringNotes: Read onlyReturns the unique ID for the project.

ProjectRoles CollectionNotes: Read onlyThe system Roles collection containing 0or more Role objects, each of which canbe associated with, for example, elements

(c) Sparx Systems 2018 Page 190 of 885

User Guide - Automation 26 July, 2018

or diagrams as the item author or owner.Use AddNew(), Delete() and GetAt() tomanage Roles.

PropertyTypes

CollectionNotes: Read onlyCollection of Property Types available tothe Repository.

Resources CollectionNotes: Read onlyContains available ProjectResourceobjects to assign to work items within theproject.Use the 'Add New()', 'Modify()' and'Delete()' functions to manage resources.

Stereotypes CollectionNotes: Read onlyThe Stereotype collection. A list ofStereotype objects that containinformation on a stereotype and theelements it can be applied to.

SuppressEADialogs

BooleanNotes: Read/WriteSet this property in theEA_OnPostNewElement broadcast event

(c) Sparx Systems 2018 Page 191 of 885

User Guide - Automation 26 July, 2018

to control whether Enterprise Architectshould suppress showing the default'Properties' dialog to the user when anelement is created.

SuppressSecurityDialog

BooleanNotes: Read/WriteSuppress the login prompt dialog thatappears by default when username andpassword parameters passed to OpenFile2are invalid. For use by externalautomation clients only.

Tasks CollectionNotes: Read onlyA list of system tasks (to do list). Eachentry is a Task Item; you can modify,delete and add new tasks.

Terms CollectionNotes: Read onlyThe Project Glossary Terms. Each Termobject is an entry in the Glossary. Add,modify and delete Terms to maintain theGlossary.

(c) Sparx Systems 2018 Page 192 of 885

User Guide - Automation 26 July, 2018

Repository Methods

Method Remarks

ActivateDiagram (longDiagramID)

Notes: Activates an already open diagram(that is, makes it the active tab) in themain Enterprise Architect user interface.Parameters:

DiagramID: Long - the ID of the·

diagram to make active

ActivatePerspective(string long)

BooleanNotes: Deprecated - no longer in use.

ActivateTab(stringName)

Notes: Activates an open EnterpriseArchitect tabbed view.Parameters:

Name: String - the name of the view to·

activate

ActivateTechnology(stringTechnologyID)

Notes: Activates an enabled MDGTechnology.Parameters:

TechnologyID: String - the ID of the·

Technology to activate, as assigned inthe MDG Technology Wizard

(c) Sparx Systems 2018 Page 193 of 885

User Guide - Automation 26 July, 2018

ActivateToolbox (stringToolbox,long Options)

BooleanNotes: Activates a Toolbox page in theGUI.The returned value is reserved for futureuse.Parameters:

Toolbox: String - the name of the·

Toolbox page to activateOptions: Long - reserved for future use·

AddDefinedSearches(stringsXML)

Notes: Used to enter a set of definedsearches that last in Enterprise Architectfor the life of the application; whenEnterprise Architect loads again theymust be inserted again by your Add-In.Parameters:

sXML: String - the XML of the defined·

searches; you can get this XML byperforming an export of the searchesfrom the 'Manage Searches' dialog inEnterprise Architect

AddDocumentationPath(string Name,string Path,long Type)

Notes: Provides an Add-In with theability to insert a book path into theEnterprise Architect installationdirectory, to display Learning Centerpages on user-authored subjects (such as

(c) Sparx Systems 2018 Page 194 of 885

User Guide - Automation 26 July, 2018

use of the Add-In).Parameters:

Name: String - the top-level (root)·

name for the Learning Centerdocumentation hierarchy for theAdd-In (for example, EnterpriseArchitect)Path: String - the directory path to the·

folder to contain the Learning Centerdocumentation structure (for example,C:\Program Files (86)\SparxSystems\EA\BooksType: Long - reserved for future use;·

set to 0

AddPerspective (stringPerspective,long Options)

BooleanNotes: Deprecated - no longer in use.

AddTab(stringTabName,stringControlID)

activeX custom controlNotes: Adds an ActiveX custom controlas a tabbed window. Enterprise Architectcreates a control and, if successful,returns its Unknown pointer, which canbe used by the caller to manipulate thecontrol.Parameters:

(c) Sparx Systems 2018 Page 195 of 885

User Guide - Automation 26 July, 2018

TabName: String - used as the tab·

captionControlID: String - the ProgID of the·

control; for example,"CS_AddinFramework.UserControl1"

AddWindow(stringWindowName,stringControlID)

activeX custom controlNotes: Adds an ActiveX custom controlas a window to the Add-Ins dockedwindow. Enterprise Architect creates acontrol and, if successful, returns itsUnknown pointer, which can be used bythe caller to manipulate the control.Parameters:

WindowName: String - used as the·

window titleControlID: String - the ProgID of the·

control; for example,"CS_AddinFramework.UserControl1"

AdviseConnectorChange(longConnectorID)

Notes: Provides an Add-In or automationclient with the ability to advise theEnterprise Architect user interface that aparticular connector has changed and, if itis visible in any open diagram, to reloadand refresh that connector for the user.Parameters:

ConnectorID: Long - the ID of the·

(c) Sparx Systems 2018 Page 196 of 885

User Guide - Automation 26 July, 2018

connector

AdviseElementChange(longObjectID)

Notes: Provides an Add-In or automationclient with the ability to advise theEnterprise Architect user interface that aparticular element has changed and, if itis visible in any open diagram, to reloadand refresh that element for the user.Parameters:

ObjectID: Long - the ID of the element·

ChangeLoginUser (stringName, stringPassword)

BooleanNotes: Sets the currently logged on userto be the one specified by a name andpassword; this logs the user into therepository when security is enabled.If security is not enabled an exception(Security not enabled) is thrown.Parameters:

Name: String - the name of the user·

Password: String - the password of the·

user

ClearAuditLogs (ObjectStartDateTime, ObjectEndDateTim

BooleanNotes: Clears all Audit Logs from themodel.If StartDateTime and EndDateTime arenot null then only log items that fall into

(c) Sparx Systems 2018 Page 197 of 885

User Guide - Automation 26 July, 2018

e) this period are cleared.Returns True for success, False forfailure.

This method cannot be undone; it is·

strongly advised that you call'SaveAuditLogs' first to backup thelogsThis method might fail if the user·

logged into the model does not havethe correct access permission

Parameters:StartDateTime: Variant (DateTime) -·

the earliest date and time of log entriesto clearEndDateTime: Variant (DateTime) -·

the latest date and time of log entries toclear

ClearOutput(stringName)

Notes: Removes all the text from a tab inthe System Output window.Parameters:

Name: String - the name of the tab to·

remove text from

CloseAddins()

Notes: Called by automation controllersto ensure that Add-Ins created in .NET donot linger after all controller references toEnterprise Architect have been cleared.

(c) Sparx Systems 2018 Page 198 of 885

User Guide - Automation 26 July, 2018

CloseDiagram (longDiagramID)

Notes: Closes a diagram in the current listof diagrams that Enterprise Architect hasopen.Parameters:

DiagramID: Long - the ID of the·

diagram to close

CloseFile () Notes: Closes any open file.

CreateDocumentGenerator()

Document GeneratorNotes: Returns a pointer to theEA.DocumentGenerator interface.

CreateModel(CreateModelTypeCreateType,stringFilePath,longParentWnd)

BooleanNotes: Creates a new .eap model filebased on the standard EnterpriseArchitect Base model, or a shortcut .eapbased on a provided SQL connection.Returns True when the new file iscreated, otherwise returns False.Parameters:

CreateType: CreateModelType -·

Specify whether to make a new copy ofthe EABase.eap model, or create a .eapfile shortcut to a DBMS repository; thelatter option requires a dialog to beopened for the user to provide SQL

(c) Sparx Systems 2018 Page 199 of 885

User Guide - Automation 26 July, 2018

connection detailsFilePath: String - Destination for new·

.eap fileParentWnd: Long - Window handle to·

act as the parent for the 'SQLconnection' dialog; only required whenusing cmEAPFromSQLRepository

CreateOutputTab (stringName)

Notes: Creates a tab in the System Outputwindow.Parameters:

Name: String - the name of the tab to·

create

DeletePerspective (stringPerspective,long Options)

BooleanNotes: Deprecated - no longer in use.

DeleteTechnology (stringID)

BooleanNotes: Removes a specified MDGTechnology resource from the repository.Returns True if the technology issuccessfully removed from the model.Returns False otherwise.

This applies to technologies imported·

into pre-7.0 versions of EnterpriseArchitect (imported technologies), not

(c) Sparx Systems 2018 Page 200 of 885

User Guide - Automation 26 July, 2018

to technologies referenced in version7.0 and later (referenced technologies)

Parameters:ID: String - the ID of the technology·

EnsureOutputVisible(stringName)

Notes: Checks that a specified tab in theSystem Output window is visible to theuser. The System Output window is madevisible if it is hidden.Parameters:

Name: String - the name of the tab to·

make visible

ExecutePackageBuildScript (longScriptOptions, stringPackageGuid)

Notes: Helps you to run the activePackage build script based on yourcurrent selection in the Project Browser.You can also run a script by passing inthe Package GUID.Parameters:

ScriptOptions: Long - the script type;·

can be any one of these numericalvalues:

1 = Build 2 = Test 3 = Run 4 = Create Workbench Instance 5 = Debug

(c) Sparx Systems 2018 Page 201 of 885

User Guide - Automation 26 July, 2018

PackageGuid: String - the ID of the·

Package for which to run the script

Exit Notes: Shuts down Enterprise Architectimmediately. Used by .NET programmerswhere the garbage collector does notimmediately release all referenced COMobjects.

ExtractImagesFromNote(string Notes,stringWriteImagePath, stringRelativeImagePath)

StringNotes: Writes any Image Manager linksto the WriteImagePath directory.Returns a modified notes text, whichcontains links to the images using theRelativeImagePath parameter.Parameters:

Notes: String - the notes of the selected·

Package, diagram or elementWriteImagePath: String - the path·

where the image file links will bestored; this path must existRelativeImagePath: String - the path to·

be inserted into the modified stringindicating where the images can befound (for example, "..\images\")

GenerateMDGTechnology

BooleanNotes: Generates an MDG Technology

(c) Sparx Systems 2018 Page 202 of 885

User Guide - Automation 26 July, 2018

(stringFilename)

file using the settings in the given MTSfile.The returned value indicates success orfailure.Parameters:

Filename: String - the name and path of·

the MTS file to use

GetActivePerspective ()

StringNotes: Deprecated - no longer in use.

GetAllDiagramImagesAndMap (stringDirectory)

BooleanNotes : Saves the image and image-mapfor every diagram in the model, in thespecified directory location.The image files will be saved in PNGformat and each will have the diagramGUID as the image name. Theimage-map files will be saved as TXTfiles and each will have the diagramGUID as the image map name.The 'Auto Create Diagram Image andImage Map' option must be selected inthe model options for this function tosave the images and image-maps.Parameters:

Directory – the location of the directory·

into which the images and image-maps

(c) Sparx Systems 2018 Page 203 of 885

User Guide - Automation 26 July, 2018

are to be saved

GetAttributeByGuid(string Guid)

AttributeNotes: Returns a pointer to an attribute inthe repository, located by its GUID. Thisis usually found using the AttributeGUIDproperty of an attribute.Parameters:

Guid: String - the GUID of the attribute·

to locate

GetAttributeByID (stringId)

AttributeNotes: Returns a pointer to an attribute inthe repository, located by its ID. This isusually found using the AttributeIDproperty of an attribute.Parameters:

Id: String - the ID of the attribute to·

locate

GetConnectorByGuid(string Guid)

ConnectorNotes: Returns a pointer to a connector inthe repository, located by its GUID. Thisis usually found using theConnectorGUID property of a connector.Parameters:

Guid: String - the GUID of the·

connector to locate

(c) Sparx Systems 2018 Page 204 of 885

User Guide - Automation 26 July, 2018

GetConnectorByID (longConnectorID)

ConnectorNotes: Searches the repository for aconnector with a specific ID.Parameters:

ConnectorID: Long - the ID of the·

connector to locate

GetContextItem (objectItem)

ObjectTypeNotes: Sets a pointer to an item in contextwithin Enterprise Architect.Also returns the correspondingObjectType.For additional information aboutContextItems and the supportedObjectTypes see the'GetContextItemType' method.Parameters:

Item: Object - the item to point to·

GetContextItemType ()

ObjectTypeNotes: Returns the ObjectType of an itemin context within Enterprise Architect. AContextItem is defined as an itemselected anywhere within the EnterpriseArchitect GUI including:

An item selected in the Project Browser·

An item selected in an open diagram·

(c) Sparx Systems 2018 Page 205 of 885

User Guide - Automation 26 July, 2018

An item selected in certain dialogs,·

such as the attribute 'Properties' dialogThe supported ObjectTypes can be anyone of these values:

otElement·

otPackage·

otDiagram·

otAttribute·

otMethod·

otConnector·

GetContextObject ()

ObjectNotes: Returns the current contextObject.

GetCounts () StringNotes: Returns a set of counts from anumber of tables within the baseEnterprise Architect repository. Thesecan be used to determine whether recordshave been added or deleted from thetables for which information is retrieved.

GetCurrentDiagram ()

DiagramNotes: Returns a selected diagram.

GetCurrentLoginUser

String

(c) Sparx Systems 2018 Page 206 of 885

User Guide - Automation 26 July, 2018

(booleanGetGuid)

Notes: If security is not enabled in therepository, an error is generated.If 'GetGuid' is True, a GUID generated byEnterprise Architect representing the useris returned; otherwise the text as enteredin System Users/User Details/Login isreturned.

GetDiagramByGuid(string Guid)

DiagramNotes: Returns a pointer to a diagramusing the global reference ID (global ID).This is usually found using the diagramGUID property of an element, and storedfor later use to open an diagram withoutusing the collection GetAt() function.Parameters:

Guid: String - the GUID of the diagram·

to locate

GetDiagramByID (longDiagramID)

DiagramNotes: Gets a pointer to a diagram usingan absolute reference number (local ID).This is usually found using theDiagramID property of an element, andstored for later use to open a diagramwithout using the collection GetAt()function.Parameters:

(c) Sparx Systems 2018 Page 207 of 885

User Guide - Automation 26 July, 2018

DiagramID: Long - the ID of the·

diagram to locate

GetDiagramImageAndMap (stringDiagramGUID, stringDirectory)

BooleanNotes: Saves the image and image-mapfor the diagram with the specified GUID,in the specified directory location.The image will be saved in PNG formatand will have the DiagramGUID as theimage name. The image-map will besaved as a TXT file and will have theDiagramGUID as the image-map name.The 'Auto Create Diagram Image andImage Map' option must be selected inthe model-specific options for thisfunction to save the image andimage-map.Parameters:

DiagramGUID – the GUID of the·

diagram for which the image andimage-map are to be savedDirectory – the directory into which the·

image and image-map are to be saved

GetElementByGuid (stringGuid)

ElementNotes: Returns a pointer to an element inthe repository, using the element's GUIDreference number (global ID). This is

(c) Sparx Systems 2018 Page 208 of 885

User Guide - Automation 26 July, 2018

usually found using the ElementGUIDproperty of an element, and stored forlater use to open an element withoutusing the collection 'GetAt ()' function.Parameters:

Guid: String - the GUID of the element·

to locate

GetElementByID (longElementID)

ElementNotes: Gets a pointer to an element usingan absolute reference number (local ID).This is usually found using theElementID property of an element, andstored for later use to open an elementwithout using the collection GetAt ()function.Parameters:

ElementID: Long - the ID of the·

element to locate

GetElementsByQuery(stringQueryName,stringSearchTerm)

Collection (of type Element)Notes: Helps you to run a search inEnterprise Architect, returning the resultas a collection.For example:GetElementsByQuery('Simple','Class1'),where the results list elements with'Class1' in the 'Name' and 'Notes' fields.

(c) Sparx Systems 2018 Page 209 of 885

User Guide - Automation 26 July, 2018

Parameters:QueryName: String - the name of the·

search to run, for example 'Simple'SearchTerm: String - the term to search·

for

GetElementSet (stringIDList, longOptions)

Collection (of type Element)Notes: Returns a set of elements as acollection based on a comma-separatedlist of ElementID values. By default, if novalues are provided in the IDListparameter, all objects for the entireproject are returned.Parameters

IDList: String - a comma-separated list·

of ElementID valuesOptions: Long - modifies default·

behavior of this method 1 - Returns empty collectionwhen empty IDList parameter is given 2 - Use IDList string as an SQLquery to populate this collection

GetFieldFromFormat(stringFormat,string Text)

StringNotes: Converts a field from yourpreferred format to Enterprise Architect'sinternal format; returns the field in thatformat.

(c) Sparx Systems 2018 Page 210 of 885

User Guide - Automation 26 July, 2018

Parameters:Format: String - The format to convert·

the field from; valid formats are: - HTML - Full HTML - RTF - Rich Text Format - TXT - Plain textText: String - The field to be converted·

GetFormatFromField(stringFormat,string Text)

StringNotes: After accessing a field thatcontains formatting, use this method toconvert it to your preferred format;returns the field in the format specified.Parameters:

Format: String - The format to convert·

the field to; valid formats are: - HTML - Full HTML - RTF - Rich Text Format - TXT - Plain textText: String - The field to be converted·

GetGapAnalysisMatrix ()

StringNotes: Read OnlyReturns all Gap Analyses as an XMLdocument.

GetLastError()

StringNotes: Returns a string value describing

(c) Sparx Systems 2018 Page 211 of 885

User Guide - Automation 26 July, 2018

the most recent error that occurred inrelation to this object.

GetLocalPath(string Type,string Path)

StringNotes: Returns the expanded local filepath for code generated from an element,with reference to the Type and Pathdefined in the 'Local Paths' dialog.Parameters:

Type: String - the coding language for·

the element, such as Java, C or C++Path: String - the local path to be·

expanded; for example:%Desk%\Javacode\Motor.java

For example: Repository.GetLocalPath (Java,%Desk%\Javacode\Motor.java)This could return:

C:\Users\fbloggs\Desktop\Javacode\Motor.java.

GetMailInterface ()

MailInterfaceNotes: Returns an instance of theEA.MailInterface; use this interface toautomate the process of creating andsending Model Mail messages.

(c) Sparx Systems 2018 Page 212 of 885

User Guide - Automation 26 July, 2018

GetMethodByGuid (stringGuid)

MethodNotes: Returns a pointer to a method inthe repository; this is usually found usingthe MethodGUID property of a method.Parameters:

Guid: String - the GUID of the method·

to look for

GetMethodById (stringId)

MethodNotes: Returns a pointer to a method inthe repository; this is usually found usingthe MethodID property of a method.Parameters:

Id: String - the ID of the method to·

look for

GetPackageByGuid (stringGuid)

PackageNotes: Returns a pointer to a Package inthe repository using the Package's GUIDreference number (global ID). This isusually found using the PackageGUIDproperty of the Package.Each Package in the model also has anassociated element with the same GUID,so if you have an element withType="Package" then you can load thePackage by calling:

(c) Sparx Systems 2018 Page 213 of 885

User Guide - Automation 26 July, 2018

GetPackageByGuid(Element.ElementGUID)Parameters:

Guid: String - the GUID of the Package·

to look for

GetPackageByID (longPackageID)

PackageNotes: Get a pointer to a Package usingan absolute reference number (local ID).This is usually found using thePackageID property of an Package, andstored for later use to open a Packagewithout using the collection GetAt ()function.Parameters:

PackageID: Long - the ID of the·

Package to locate

GetProjectInterface ()

ProjectNotes: Returns a pointer to theEA.Project interface (the XML-basedautomation server for EnterpriseArchitect). Use this interface to workwith Enterprise Architect using XML,and also to access utility functions forloading diagrams, running reports and soon.

(c) Sparx Systems 2018 Page 214 of 885

User Guide - Automation 26 July, 2018

GetReferenceList (stringType)

ReferenceNotes: Uses the list type to get a pointerto a Reference List object.Parameters:

Type: String - specifies the list type to·

get; valid list types are:DiagramElementConstraintRequirementConnectorStatusCardinalityEffortMetricScenarioStatusTestList:DifficultyTypeList:PriorityTypeList:TestStatusTypeList:ConstStatusType

GetRelationshipMatrix ()

StringNotes: Returns an XML document (as astring), containing definitions of allRelationship Matrix profiles saved in thecurrent model.

(c) Sparx Systems 2018 Page 215 of 885

User Guide - Automation 26 July, 2018

GetTechnologyVersion(string ID)

StringNotes: Returns the version of a specifiedMDG Technology resource.Parameters:

ID: String - the specified technology ID·

GetTreeSelectedElements()

CollectionNotes: Returns the set of elementscurrently selected in the Project Browseras a collection.

GetTreeSelectedItem(objectSelectedItem)

ObjectTypeNotes: Gets an object variable and typecorresponding to the currently selecteditem in the tree view.To use this function, create a genericobject variable and pass this as theparameter. Depending on the return type,cast it to a more specific type.The object passed back through theparameter can be a Package, element,diagram, attribute or operation object.Parameters:

SelectedItem: Object - the object to get·

the variable and type for

GetTreeSelectedItemType

ObjectTypeNotes: Returns the type of the object

(c) Sparx Systems 2018 Page 216 of 885

User Guide - Automation 26 July, 2018

() currently selected in the tree. One of:otDiagram·

otElement·

otPackage·

otAttribute·

otMethod·

GetTreeSelectedObject ()

ObjectNotes: The related methodGetTreeSelectedItem () has an outputparameter that is inaccessible by somescripting languages. As an alternative,this method provides the selected itemthrough the return value.

GetTreeSelectedPackage ()

PackageNotes: Returns the Package in which thecurrently selected tree view object iscontained.

HasPerspective (stringPerspective)

StringNotes: Deprecated - no longer in use.

HideAddinWindow ()

Notes: Hides the docked Add-In window.

ImportPacka Notes: Imports build scripts into a

(c) Sparx Systems 2018 Page 217 of 885

User Guide - Automation 26 July, 2018

geBuildScripts (stringPackageGuid, stringBuildScriptXML)

Package in Enterprise Architect.Parameters:

PackageGuid: String - the GUID of the·

Package into which to import the buildscriptsBuildScriptXML: String - the build·

script XML data, which you can exportfrom within Enterprise Architect

ImportRASAsset (stringPackageGUID, stringProtocol,stringServerName,string Model,stringStorage,stringRASGUID,stringPassword,stringVersion)

Notes: Imports the specified RAS asset.Returns True on success; checkGetLastError on failure.Parameters:

PackageGUID: String - the GUID of·

the Package to import the asset toProtocol: String - the protocol the·

server is usingServerName: String - the name of the·

RAS serverModel: String - the name of the RAS·

model to useStorage: String - the storage name of·

the RAS assetRASGUID: String - the GUID of the·

RAS assetPassword: String - the password to·

access the RAS asset

(c) Sparx Systems 2018 Page 218 of 885

User Guide - Automation 26 July, 2018

Version: String - the version of the·

RAS asset to import

ImportTechnology (stringTechnology)

BooleanNotes: Installs a given MDG Technologyresource into the repository.Returns True if the technology issuccessfully loaded into the model.Otherwise returns False.This applies to technologies importedinto pre-7.0 versions of EnterpriseArchitect (imported technologies), not totechnologies referenced in version 7.0and later (referenced technologies).Parameters:

Technology: String - the contents of the·

technology resource file

InvokeConstructPicker(stringElementFilter)

StringNotes: Invokes the 'Select <Item>' dialogwith filters on the object type and,optionally, stereotype. Returns theElementID of the selected object, or 0 ifno object was selected when the dialogwas closed.For example:

elementid=Repository.InvokeConstructPicker("IncludedTypes=Class,Component;

(c) Sparx Systems 2018 Page 219 of 885

User Guide - Automation 26 July, 2018

StereoType=foo,bar")In this example, the 'Select <item>' dialogwill allow the user to select any Class orComponent element in the model that hasa stereotype of 'foo' or 'bar'. The'IncludedTypes' and 'StereoType' filtersare separated by a semi-colon.Parameters:

ElementFilter: String - specifies which·

elements or Packages are to be madeavailable for selection, based onelement types and stereotypesidentified by the IncludedTypes andStereoType filters - IncludedTypes - (mandatory)comma separated list of element typesthat can be selected in the dialog; for example: Package,Class,Component - MultiSelect - (optional) when set toTrue ("MultiSelect=True;") allows theConstruct picker to select multiple elements - Selection (optional) - list ofcomma-separated element GUID's thatwill be selected by default - GetNext (optional) - returns thenext ID in the list of selected elements,or 0 when no more are

(c) Sparx Systems 2018 Page 220 of 885

User Guide - Automation 26 July, 2018

available; this option will notdisplay a dialog and assumes the firstcall was made with MultiSelect=True; - StereoType - (optional) commaseparated list of stereotypes that can beselected in this dialog

Do not use leading or trailing spacesbetween element type or stereotypevalues. Parameter values must be writtenwith the correct case; element type namesare also case sensitive.Example: val =Repository.InvokeConstructPicker("IncludedTypes=Class;MultiSelect=True;"); while(val != 0) { val =Repository.InvokeConstructPicker("GetNext=True;"); }

InvokeFileDialog (stringFilterString,longFilterindex,

StringNotes: Opens a standard 'Open File'dialog and returns a string containing thefull path to the selected file on success.Returns an empty string if the dialog was

(c) Sparx Systems 2018 Page 221 of 885

User Guide - Automation 26 July, 2018

long Flags) canceled.Parameters:

FilterString: String - list of file type·

filters.Filterindex: Long - one-based index of·

the filter to be used by defaultFlags: Long - additional bit flags used·

to initialize the file dialog; seeOPENFILENAME structure in MSDNdocumentation for accepted values

IsTabOpen(stringTabName)

StringNotes: Checks whether a namedEnterprise Architect tabbed view is openand active. This includes open diagramwindows or custom controls added using'Repository.AddTab ()'.Returns:

2 to indicate that a tab is open and·

active (top-most)1 to indicate that it is open but not·

top-most, or0 to indicate that it is not visible at all·

Parameters:TabName: String - the name of the tab·

to check for; TabName is case sensitive

IsTechnology

(c) Sparx Systems 2018 Page 222 of 885

User Guide - Automation 26 July, 2018

Enabled(string ID)

BooleanNotes: Checks whether the specifiedstring matches the ID of an enabled MDGTechnology in Enterprise Architect.Returns True if the string matches the IDof an enabled Technology. Otherwisereturns False.Parameters:ID: String - the technology ID to checkfor; built-in technology IDs include:

ArcGIS·

ArcGISBABOK·

BABOKBIZBOK·

BIZBOK GuideBPSim BPSim·

BRM·

Business Rule ModelCMMN Case·

Management Model & NotationCODEENG Code·

EngineeringDatabase Modeling Database·

ModelingDMN1.1·

DMN1.1

(c) Sparx Systems 2018 Page 223 of 885

User Guide - Automation 26 July, 2018

EAExtended Core·

ExtensionsERD Entity·

Relationship DiagramGML GML·

MYSQLTECH·

MySqlTechEAReview Review·

SIMF SIMF·

TechnologySOAML·

SOAMLSysML1.1·

SysML1.1SysML1.2·

SysML1.2SysML1.3·

SysML1.3SysML1.4·

SysML1.5UML2 Basic·

UML2 TechnologySYSENG System·

Engineering262139 MDG·

Technology BuilderTOGAF TOGAF·

(c) Sparx Systems 2018 Page 224 of 885

User Guide - Automation 26 July, 2018

UAF UAF·

UPDM2 UPDM·

2.0Win32UI Win 32·

User Interface ModelingZF·

Zachman FrameworkTechnically, any combination oftechnologies integrated with or added toEnterprise Architect - includinguser-developed technologies - couldappear in this list. In practice you wouldonly check for one or two technologies ata time.

IsTechnologyLoaded(string ID)

BooleanNotes: Checks whether a specifiedtechnology is loaded into the repository.Returns True if the MDG Technologyresource is loaded into the repository.Otherwise returns False.Parameters:

ID: String - the technology ID to check·

for

LoadAddins()

Notes: Loads all Add-Ins from arepository when Enterprise Architect isopened from automation.

(c) Sparx Systems 2018 Page 225 of 885

User Guide - Automation 26 July, 2018

OpenDiagram (longDiagramID)

Notes: Provides a method for anautomation client or Add-In to open adiagram. The diagram is added to thetabbed list of open diagrams in the mainEnterprise Architect view.Parameters:

DiagramID: Long - the ID of the·

diagram to open

OpenFile(stringFilename)

BooleanNotes: This is the main point for openingan Enterprise Architect project file froman automation client, and working withthe contained objects.If the required project is a DBMSrepository, and you have created ashortcut .eap file containing the databaseconnection string, you can call thisshortcut file to access the DBMSrepository.You can also connect to a SQL databaseby passing in the connection string itselfinstead of a filename. A valid connectionstring can be obtained from the 'OpenProject' dialog by selecting a recentlyopened SQL repository.Parameters:

Filename: String - the filename of the·

(c) Sparx Systems 2018 Page 226 of 885

User Guide - Automation 26 July, 2018

Enterprise Architect project to open

OpenFile2(stringFilePath,stringUsername,stringPassword)

BooleanNotes: As for 'OpenFile ()' except thisprovides for the specification of apassword.Parameters:

Filepath: String - the file path of the·

Enterprise Architect project to openUsername: String - the user login ID·

Password: String - the user password·

RefreshModelView (longPackageID)

Notes: Reloads a Package or the entiremodel, updating the user interface.Parameters:

PackageID: Long - the ID of the·

Package to reload: if 0, the entiremodel is reloaded; if a valid PackageID, only that Package is reloaded

RefreshOpenDiagrams(booleanFullReload)

Notes: Reloads the diagram contents forall open diagrams from the repository.Parameters:

FullReload: Boolean - if False only the·

contents of element compartments arereloaded; if True the full content ofeach diagram is reloaded

(c) Sparx Systems 2018 Page 227 of 885

User Guide - Automation 26 July, 2018

ReloadDiagram (longDiagramID)

Notes: Reloads a specified diagram. Thiswould commonly be used to refresh avisible diagram after code import/exportor other batch process where the diagramrequires complete refreshing.Calling this method within a call toEA_OnNotifyContextItemModified is notsupportedParameters:

DiagramID: Long - the ID of the·

diagram to be reloaded

ReloadPackage (longPackageID)

Notes: Reloads a Package and its openchild diagrams.Parameters:PackageID: Long - The ID of the Packageto reload; if a valid Package ID, only thatPackage is reloaded.

RemoveOutputTab (stringName)

Notes: Removes a specified tab from theSystem Output window.Parameters:

Name: String - the name of the tab to·

be removed

RemoveWindow (stringWindowNam

BooleanNotes: Removes an Add-In window thatmatches the specified WindowName.

(c) Sparx Systems 2018 Page 228 of 885

User Guide - Automation 26 July, 2018

e) Parameters:WindowName: String - the name of the·

window to remove

RepositoryType ()

StringNotes: Returns the currently opendatabase/repository type.Can return one of these values:

JET (.EAP file, MS Access 97 to 2013·

format)FIREBIRD·

ACCESS2007 (.accdb file, MS Access·

2007+ format)ASA (Sybase SQL Anywhere)·

SQLSVR (Microsoft SQL Server)·

MYSQL (MySQL)·

ORACLE (Oracle)·

POSTGRES (PostgreSQL)·

RunModelSearch (stringsQueryName,stringsSearchTerm,stringsSearchOptions, string

Notes: Runs a search, displaying theresults in Enterprise Architect's ModelSearch window.Parameters:

sQueryName: String - the name of the·

search to run, for example SimplesSearchTerm: String - the term to·

search for

(c) Sparx Systems 2018 Page 229 of 885

User Guide - Automation 26 July, 2018

sSearchData) sSearchOptions: String - currently not·

being usedsSearchData: String - a list of results in·

the form of XML, which is appendedonto the result list in EnterpriseArchitect - see the XML Format topic;this parameter is not mandatory so passin an empty string to run the search asper normal

SaveAllDiagrams ()

Notes: Saves all open diagrams.

SaveAuditLogs (stringFilePath,objectStartDateTime, objectEndDateTime)

BooleanNotes: Saves the Audit Logs containedwithin a model to a specified file.If 'StartDateTime' and 'EndDateTime' arenot null then only log items that fall intothis period are saved.Returns True for success, False forfailure.

This might fail if the user logged into·

the model does not have the correctaccess permission

Parameters:FilePath: String - the file to save the·

Audit Logs toStartDateTime: Variant (DateTime) -·

(c) Sparx Systems 2018 Page 230 of 885

User Guide - Automation 26 July, 2018

the earliest date and time of log entriesto saveEndDateTime; Variant (DateTime) -·

the latest date and time of log entries tosave

SaveDiagram(longDiagramID)

Notes: Saves an open diagram; assumesthe diagram is open in the main userinterface Tab list.Parameters:

DiagramID: Long - the ID of the·

diagram to save

SaveDiagramAsUMLProfile (stringDiagramGUID, stringFilename)

BooleanNotes: Saves a given diagram as a UMLProfile, using the settings from theprevious time that the specific diagramwas saved.The returned value indicates success orfailure.Parameters:

DiagramGUID: String - the GUID of·

the Profile diagram to saveFilename: String - the name and path of·

the file to create; if left blank, themethod will use the filename from theprevious time the specified diagramwas saved

(c) Sparx Systems 2018 Page 231 of 885

User Guide - Automation 26 July, 2018

SavePackageAsUMLProfile (stringPackageGUID, stringFilename)

BooleanNotes: Saves a given Package as a UMLProfile, using the settings from theprevious time that the specific Packagewas saved.The returned value indicates success orfailure.Parameters:

PackageGUID: String - the GUID of·

the Profile Package to saveFilename: String - the name and path of·

the file to create; if left blank, themethod will use the filename from theprevious time the specified Packagewas saved

ScanXMIAndReconcile ()

Notes: Scans the Package XMI filesassociated with each of the project'scontrolled Packages and restores anydiagram objects or cross-references thatare detected as missing from the project.This function is useful in teamenvironments where each user maintainstheir own private copy of the modeldatabase (that is, multiple private EAPfiles) and model updates are propagatedthrough the use of controlled Packages; itprovides no benefit when the model is

(c) Sparx Systems 2018 Page 232 of 885

User Guide - Automation 26 July, 2018

hosted in a single shared database that isaccessed by all team members.Each controlled Package is comparedwith its associated XMI file and, if thecross-reference information in the modeldoes not match the XMI, EnterpriseArchitect updates the model with theinformation from the XMI and recordsthe update in the System Output window.You can roll back such updates byright-clicking on the entry in the SystemOutput window and selecting the'Rollback Update' option (or 'RollbackSelected Updates' if multiple entries areselected).Closing the model clears the entries in theSystem Output window; an entry in thiswindow is also cleared as and when youroll-back the update for it.This functionality is invokedautomatically as part of the 'Get AllLatest' operation.When working in an environment thatuses a Private Model deployment andyour model contains a significant numberof cross-Package references, it isrecommended that you invoke thisfunction from time to time, following there-importation of controlled Packages -

(c) Sparx Systems 2018 Page 233 of 885

User Guide - Automation 26 July, 2018

for example, after using 'Get Latest' toupdate a number of Packages, or afterperforming a number of Packagecheck-outs.As a general rule, avoid running thisfunction while you have uncommittedchanges in your model. Generally, you:

Check-out a number of Packages·

Invoke 'ScanXMIAndReconcile'·

Make your modifications·

Commit any outstanding changes·

before you check-out more Packagesand run 'ScanXMIAndReconcile' again

ShowAddinWindow(stringTabName)

BooleanNotes: Shows the docked Add-In windowon the specified page. Returns True if atab of the specified name is nowdisplayed.Parameters

TabName: String - specifies the tab·

ShowDynamicHelp (stringTopic)

Notes: Shows a Help topic as a view.Parameters:

Topic: String - specifies the Help topic·

ShowInProjectView

Notes: Selects a specified object in theProject Browser.

(c) Sparx Systems 2018 Page 234 of 885

User Guide - Automation 26 July, 2018

(object Item) Accepted object types are Package,Element, Diagram, Attribute, andMethod; an exception is thrown if theobject is of an invalid type.Parameters:

Item: Object - the object to highlight·

ShowWindow (longShow)

Notes: Shows or hides the EnterpriseArchitect User Interface.Parameters:

Show: Long·

SQLQuery(string SQL)

StringNotes: Enables execution of a SQL selectstatement against the current repository.Returns an XML formatted string valueof the resulting record set.Parameters:

SQL: String - contains the SQL Select·

statement

SynchProfile(stringProfile, stringStereotype)

BooleanNotes: Synchronizes Tagged Values andconstraints of a UML Profile item usingthe 'Synch Profiled Elements' dialog.Parameters:

Profile: String - the name of the profile·

(c) Sparx Systems 2018 Page 235 of 885

User Guide - Automation 26 July, 2018

that contains the stereotypeStereotype: String - the name of the·

profile stereotype for which the defaulttags and constraints are to besynchronized

VersionControlResynchPkgStatuses(booleanClearSettings)

Notes: Synchronizes the version controlstatus of each version controlled Packagewithin the current model with the statusreported by your version control provider.Parameters:

ClearSettings: Boolean·

- if True, clear the version controlsettings from Packages that are reported by the version controlprovider as uncontrolled - if False, leave the version controlsettings unchanged for Packages reported as uncontrolled

WriteOutput(string Name,string Output,long ID)

Notes: Writes text to a specified tab in theSystem Output window, and associatesthe text with an ID.Parameters:

Name: String - specifies the tab on·

which to display the textOutput: String - specifies the text to·

display

(c) Sparx Systems 2018 Page 236 of 885

User Guide - Automation 26 July, 2018

ID: Long - specifies a numeric ID·

value to associate with this output itemfor further handling by Add-Ins; can beset to 0 if no handling is required

(c) Sparx Systems 2018 Page 237 of 885

User Guide - Automation 26 July, 2018

Stereotype Class

The Stereotype element corresponds to a UML stereotype,which is an extension mechanism for varying the behaviorand type of a model element. Use the RepositoryStereotypes collection to add new elements and deleteexisting ones.

Associated table in .EAP file

t_stereotypes

Stereotype Attributes

Attribute Description

AppliesTo StringNotes: Read/WriteA reference to the stereotype Base Class;that is, which element it applies to.

MetafileLoadPath

StringNotes: Read/WriteThe path to an associated metafile. TheAutomation Interface does not yet

(c) Sparx Systems 2018 Page 238 of 885

User Guide - Automation 26 July, 2018

support loading metafiles. To do this youmust use the 'Stereotype' tab of the 'UMLTypes' dialog in Enterprise Architect.

Notes StringNotes: Read/Write.Notes about the stereotype.

Name StringNotes: Read/WriteThe stereotype name, which appears inthe Stereotype drop list for elements thatmatch the AppliesTo attribute.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

StereotypeGUID

StringNotes: Read/WriteA unique identifier for stereotype,generally set and maintained byEnterprise Architect.

Style StringNotes: Read/Write

(c) Sparx Systems 2018 Page 239 of 885

User Guide - Automation 26 July, 2018

An additional style specifier for thestereotype.

VisualType StringNotes: Read/WriteIndicates an inbuilt visual style associatedwith a stereotype.Not currently implemented.

Stereotype Methods

Method Description

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current stereotypeobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 240 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 241 of 885

User Guide - Automation 26 July, 2018

Task Class

A Task is an entry in the System ToDo list. Tasks can beaccessed using the Repository Tasks collection.

Associated table in .EAP file

t_tasks

Task Attributes

Attribute Remarks

ActualTime LongNotes: Read/WriteThe time already expended on the task, inhours, days or other units.

AssignedTo StringNotes: Read/WriteThe person this task is assigned to; thatis, the responsible resource.

EndDate Date

(c) Sparx Systems 2018 Page 242 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe date the task is scheduled to finish.

History StringNotes: Read/WriteA memo field to hold, for example, taskhistory or notes.

Name VariantNotes: Read/WriteThe task name.

Notes VariantNotes: Read/WriteA description of the task.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Owner StringNotes: Read/WriteThe task owner.

Percent LongNotes: Read/Write

(c) Sparx Systems 2018 Page 243 of 885

User Guide - Automation 26 July, 2018

The percentage completion of the task.

Phase StringNotes: Read/WriteThe phase of the project the task relatesto.

Priority StringNotes: Read/WriteThe priority of this task.

StartDate DateNotes: Read/WriteThe date the task is to start.

Status VariantNotes: Read/WriteThe current status of the task.

TaskID LongNotes: Read onlyThe local ID of the task.

TotalTime LongNotes: Read/WriteThe total expected time the task mightrun, in hours, days or some other unit.

(c) Sparx Systems 2018 Page 244 of 885

User Guide - Automation 26 July, 2018

Type StringNotes: Read/WriteSets or returns a string representing thetype.

Task Methods

Method Type

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current Task objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 245 of 885

User Guide - Automation 26 July, 2018

Term Class

A Term object represents one entry in the system glossary.Terms can be accessed using the Repository Termscollection.

Associated table in .EAP file

t_glossary

Term Attributes

Attribute Remarks

Meaning StringNotes: Read/WriteThe description of the term; its meaning.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Term String

(c) Sparx Systems 2018 Page 246 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe glossary item name.

TermID LongNotes: Read onlyA local ID number to identify the term inthe model.

Type StringNotes: Read/WriteThe type this term applies to (forexample, business or technical).

Term Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Refresh VoidNotes: Forces Enterprise Architect toreload the Glossary terms from the

(c) Sparx Systems 2018 Page 247 of 885

User Guide - Automation 26 July, 2018

database.If an element is selected, it will have tobe re-selected before the 'Note' fields andwindows reflect the updated Glossaryterms.

Update() BooleanNotes: Updates the current Term objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 248 of 885

User Guide - Automation 26 July, 2018

Element Package

The Element Package contains information about anelement and its associated extended properties such astesting and project management information. An element isthe basic item in an Enterprise Architect model. Classes,Use Cases and Components are all different types of UMLelement.

This diagram illustrates the relationships between anelement and its associated extended information. The relatedinformation is accessed through the collections owned bythe element (for example, Scenarios and Tests). It alsoincludes a full description of the element object (the basicmodel structural unit).

Example

(c) Sparx Systems 2018 Page 249 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 250 of 885

User Guide - Automation 26 July, 2018

Constraint Class

A Constraint is a condition imposed on an element.Constraints are accessed through the Element Constraintscollection.

Associated table in .EAP file

t_objectconstraints

Constraint Attributes

Attribute Remarks

Name StringNotes: Read/WriteThe name of the constraint (that is, theconstraint).

Notes StringNotes: Read/WriteNotes about the constraint.

ObjectType ObjectType

(c) Sparx Systems 2018 Page 251 of 885

User Guide - Automation 26 July, 2018

Notes: Read onlyDistinguishes objects referenced througha Dispatch interface.

ParentID LongNotes: Read onlyThe ElementID of the element to whichthis constraint applies.

Status StringNotes: Read/WriteThe current status of the constraint.

Type StringNotes: Read/WriteThe constraint type.

Weight LongNotes: Read/WriteA weighting factor.

Constraint Methods

Method Remarks

(c) Sparx Systems 2018 Page 252 of 885

User Guide - Automation 26 July, 2018

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the current Constraintobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 253 of 885

User Guide - Automation 26 July, 2018

Effort Class

An Effort is a named item with a weighting that can beassociated with an element for purposes of building metricsabout the model. Efforts are accessed through the ElementEfforts collection.

Associated table in .EAP file

t_objecteffort

Effort Attributes

Attribute Remarks

Name StringNotes: Read/WriteThe name of the effort.

Notes StringNotes: Read/WriteNotes about the effort.

ObjectType ObjectType

(c) Sparx Systems 2018 Page 254 of 885

User Guide - Automation 26 July, 2018

Notes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Type StringNotes: Read/WriteThe effort type.

Weight LongNotes: Read/WriteA weighting factor.

Weight2 FloatNotes: Read/WriteA weighting factor.

Effort Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

(c) Sparx Systems 2018 Page 255 of 885

User Guide - Automation 26 July, 2018

Update() BooleanNotes: Update the current Effort objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 256 of 885

User Guide - Automation 26 July, 2018

Element Class

An Element is the main modeling unit, corresponding to (forexample) a Class, Use Case, Node or Component. Youcreate new elements by adding to the Package Elementscollection. Once you have created an element, you can add itto the DiagramObject Class of a diagram to include it in thediagram.

Elements also have a collection of connectors. Each entry inthis collection indicates a relationship to another element.

There are also some extended collections for managingaddition information about the element, including propertiessuch as Tagged Values, Issues, Constraints andRequirements.

Associated table in .EAP file

t_object

Element Attributes

Attribute Remarks

Abstract StringNotes: Read/Write

(c) Sparx Systems 2018 Page 257 of 885

User Guide - Automation 26 July, 2018

Indicates if the element is Abstract (1) orConcrete (0).

ActionFlags StringNotes: Read/WriteA structure to hold flags concerned withAction semantics.

Alias StringNotes: Read/WriteAn optional alias for this element.

AssociationClassConnectorID

LongNotes: Read onlyIf the element is an AssociationClass,AssociationClassConnectorID containsthe Connector ID of the respectiveAssociation connector.

Attributes CollectionNotes: Read onlyA collection of Attribute objects for thecurrent element; use the AddNew andDelete functions to manage attributes.

AttributesEx CollectionNotes: Read only

(c) Sparx Systems 2018 Page 258 of 885

User Guide - Automation 26 July, 2018

A collection of Attribute objectsbelonging to the current element and itsparent elements.

Author StringNotes: Read/WriteThe element author.

BaseClasses CollectionNotes: Read onlyA list of Base Classes for this element,presented as a collection for convenience.

ClassfierID LongNotes: DeprecatedSee 'ClassifierID'.

ClassifierID LongNotes: Read/WriteThe ElementID of a Classifier associatedwith this element; that is, the base type.Only valid for instance type elements(such as Object or Sequence).

ClassifierName

StringNotes: Read/WriteName of associated Classifier (if any).

(c) Sparx Systems 2018 Page 259 of 885

User Guide - Automation 26 July, 2018

ClassifierType

StringNotes: Read onlyType of associated Classifier.

Complexity StringNotes: Read/WriteA complexity value indicating howcomplex the element is; used for metricreporting and estimation.Valid values are: 1 for Easy, 2 forMedium, 3 for Difficult.

CompositeDiagram

DiagramNotes: Read onlyIf the element is Composite, returns itsassociated diagram; otherwise returnsnull.

Connectors CollectionNotes: Read onlyReturns a collection containing theconnectors to other elements.

Constraints CollectionNotes: Read onlyA collection of Constraint objects.

(c) Sparx Systems 2018 Page 260 of 885

User Guide - Automation 26 July, 2018

ConstraintsEx

CollectionNotes: Read onlyCollection of Constraint objectsbelonging to the current element and itsparent elements.

Created DateNotes: Read/WriteThe date the element was created.

CustomProperties

CollectionNotes: Read onlyList of advanced properties for anelement.The collection of advanced propertiesdiffers depending on element type; forexample, an Action and an Activity havedifferent advanced properties.Currently only editable from the userinterface.

Diagrams CollectionNotes: Read onlyReturns a collection of sub-diagrams(child diagrams) attached to this elementas seen in the tree view.

(c) Sparx Systems 2018 Page 261 of 885

User Guide - Automation 26 July, 2018

Difficulty StringNotes: Read/WriteA difficulty level associated with thiselement for estimation/metrics; onlyuseable for Requirement, Change andIssue element types, otherwise ignored.Valid values are: Low, Medium, High.

Efforts CollectionNotes: Read onlyA collection of Effort objects.

ElementGUID

StringNotes: Read onlyA globally unique ID for this element;that is, unique across all model files.

ElementID LongNotes: Read onlyThe local ID of the Element; valid for thisfile only.

Elements CollectionNotes: Read onlyReturns a collection of child elements(sub-elements) attached to this element asseen in the tree view.

(c) Sparx Systems 2018 Page 262 of 885

User Guide - Automation 26 July, 2018

EmbeddedElements

CollectionNotes: Read onlyA list of elements that are embedded intothis element, such as Ports, Parts, Pinsand Parameter Sets.

EventFlags StringNotes: Read/WriteA structure to hold a variety of flags to dowith signals or events.

ExtensionPoints

StringNotes: Read/WriteOptional extension points for a Use Caseas a comma-separated list.

Files CollectionNotes: Read onlyA collection of File objects.

FQName StringNotes: Read onlyThe fully-qualified name of the element,consisting of a dot-separated list of namesincluding all parent elements andPackages up to the first namespace rootthat is encountered.

(c) Sparx Systems 2018 Page 263 of 885

User Guide - Automation 26 July, 2018

FQStereotype StringNotes: Read onlyThe fully-qualified stereotype name in theformat "Profile::Stereotype". One or morefully-qualified stereotype names can beassigned to StereotypeEx.

GenFile StringNotes: Read/WriteThe file associated with this element forcode generation and synchronizationpurposes; can include macro expansiontags for local conversion to full path.

Genlinks StringNotes: Read/WriteLinks to other Classes discovered at codereversing time; Parents and Implementsconnectors only.

GenType StringNotes: Read/WriteThe code generation type; for example,Java, C++, C#, VBNet, Visual Basic,Delphi.

Header1 Variant

(c) Sparx Systems 2018 Page 264 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteA user defined string for inclusion asheader in the source files generated.

Header2 VariantNotes: Read/WriteSame as for Header1, but used in the CPPsource file.

IsActive BooleanNotes: Read/WriteBoolean value indicating whether theelement is active or not.1 = True, 0 = False.

IsComposite BooleanNotes: Read/WriteIndicates whether the element iscomposite or not.1 = True, 0 = False.

IsLeaf BooleanNotes: Read/WriteIndicates whether or not the element is aleaf node (and therefore cannot be aparent for any other elements).1 = True, 0 = False.

(c) Sparx Systems 2018 Page 265 of 885

User Guide - Automation 26 July, 2018

IsNew BooleanNotes: Read/WriteBoolean value indicating whether theelement is new or not.1 = True, 0 = False.

IsRoot BooleanNotes: Read/WriteIndicates whether or not the element is aroot node (and therefore cannot bedescended from another element).1 = True, 0 = False.

IsSpec BooleanNotes: Read/WriteBoolean value indicating whether theelement is a specification or not.1 = True, 0 = False.

Issues CollectionNotes: Read onlyCollection of Issue objects.

Locked BooleanNotes: Read/WriteIndicates if the element has been locked

(c) Sparx Systems 2018 Page 266 of 885

User Guide - Automation 26 July, 2018

against further change.

MetaType StringNotes: Read onlyThe element's domain-specific meta type,as defined by an applied stereotype froman MDG Technology.

Methods CollectionNotes: Read onlyCollection of Method objects for currentelement.

MethodsEx CollectionNotes: Read onlyCollection of Method objects belongingto the current element and its parentelements.

Metrics CollectionNotes: Read onlyCollection of Metric elements for currentelement.

MiscData StringNotes: Read onlyThis low-level property provides

(c) Sparx Systems 2018 Page 267 of 885

User Guide - Automation 26 July, 2018

information about the contents of thePData x fields.These database fields are notdocumented, and developers must gainunderstanding of these fields throughtheir own endeavors to use this property.MiscData is zero based, therefore:

MiscData(0) corresponds to PData1·

MiscData(1) to PData2, and so on·

Modified DateNotes: Read/WriteThe date the element was last modified.

Multiplicity StringNotes: Read/WriteMultiplicity value for this element.

Name StringNotes: Read/WriteThe element name; should be uniquewithin the current Package.

Notes StringNotes: Read/WriteFurther descriptive text about theelement.

(c) Sparx Systems 2018 Page 268 of 885

User Guide - Automation 26 July, 2018

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

PackageID LongNotes: Read/WriteA local ID for the Package containingthis element.

ParentID LongNotes: Read/WriteIf this element is a child of another, usedto set or retrieve the ElementID of theother element; if not, returns 0.

Partitions CollectionNotes: Read onlyList of logical partitions into which anelement can be divided.Only valid for elements that supportpartitions, such as Activities and States.

Persistence StringNotes: Read/WriteThe persistence associated with this

(c) Sparx Systems 2018 Page 269 of 885

User Guide - Automation 26 July, 2018

element; can be Persistent or Transient.

Phase StringNotes: Read/WriteThe phase this element is scheduled to beconstructed in; any string value.

Priority StringNotes: Read/WriteThe priority of this element as comparedto other project elements; only applies toRequirement, Change and Issue types,otherwise ignored.Valid values are: Low, Medium andHigh.

Properties PropertiesNotes: Returns a list of specializedproperties that apply to the element thatmight not be available using theautomation model.The properties are purposelyundocumented because of their obscurenature and because they are subject tochange as progressive enhancements aremade to them.

PropertyType Long

(c) Sparx Systems 2018 Page 270 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe ElementID of a Type associated withthis element; only valid for Port and Partelements.

PropertyTypeName

StringNotes: ReadThe name of a Type associated with thiselement; only valid for Port and Partelements.

Realizes CollectionNotes: Read onlyList of Interfaces realized by this elementfor convenience.

Requirements CollectionNotes: Read onlyCollection of Requirement objects.

RequirementsEx

CollectionNotes: Read onlyCollection of Requirement objectsbelonging to the current element and itsparent elements.

Resources Collection

(c) Sparx Systems 2018 Page 271 of 885

User Guide - Automation 26 July, 2018

Notes: Read onlyCollection of Resource objects for currentelement.

Risks CollectionNotes: Read onlyCollection of Risk objects.

RunState StringNotes: Read/WriteThe object's runstate list as a string.

Scenarios CollectionNotes: Read onlyCollection of Scenario objects for currentelement.

StateTransitions

CollectionNotes: Read onlyList of State Transitions that an elementcan support; applies in particular toTiming elements.

Status StringNotes: Read/WriteSets or gets the status, such as Proposedor Approved.

(c) Sparx Systems 2018 Page 272 of 885

User Guide - Automation 26 July, 2018

Stereotype StringNotes: Read/WriteThe primary element stereotype; the firstof the list of stereotypes you can accessusing the 'StereotypeEx' attribute.

StereotypeEx StringNotes: Read/WriteAll the applied stereotypes of the elementin a comma-separated list. Reading thevalue will provide the stereotype nameonly; assigning the value accepts eitherfully-qualified or simple names.

StyleEx StringNotes: Read/WriteAdvanced style settings; reserved for theuse of Sparx Systems.

Subtype LongNotes: Read/WriteA numeric subtype that qualifies the Typeof the main element

For Event: 0 = Receiver, 1 = Sender·

For Class: 1 = Parameterised, 2 =·

Instantiated, 3 = Both, 0 = Neither,17 = Association Class

(c) Sparx Systems 2018 Page 273 of 885

User Guide - Automation 26 July, 2018

If 17, because an Association Class hasbeen created through the user interface,MiscData(3) contains the ID of therelated Association; as MiscData isread-only, you cannot create anAssociation Class through theAutomation Interface:

For Note: 1 = Note linked to connector,·

2 = Constraint linked to connectorFor StateNode: 100 = ActivityIntitial,·

101 = ActivityFinalFor Activity: 0 = Activity, 8 =·

composite Activity (also set to 8 forother composite elements such as UseCases)For Synchronization: 0 = Horizontal, 1·

= Vertical

Note that there are many more Typesthan indicated in the above examples.

Tablespace StringNotes: Read/WriteAssociated tablespace for a Tableelement.

Tag String

(c) Sparx Systems 2018 Page 274 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteCorresponds to the 'Keywords' field inthe Enterprise Architect user interface.

TaggedValues

CollectionNotes: Read onlyReturns a collection of TaggedValueobjects.

TaggedValuesEx

CollectionNotes: Read onlyReturns a collection of TaggedValueobjects belonging to the current elementand the elements specialized or realizedby the current element.

TemplateParameters

CollectionNotes: Read OnlyA collection of TemplateParameterobjects.

Tests CollectionNotes: Read onlyA collection of Test objects for thecurrent element.

TreePos Long

(c) Sparx Systems 2018 Page 275 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteSets or gets the tree position.

Type StringNotes: Read/WriteThe element type (such as Class,Component).Note that Type is case sensitive insideEnterprise Architect and should beprovided with an initial capital (propercase); valid types are:

Action·

Activity·

ActivityPartition·

ActivityRegion·

Actor·

Artifact·

Association·

Boundary·

Change·

Class·

Collaboration·

Component·

Constraint·

Decision·

DeploymentSpecification·

(c) Sparx Systems 2018 Page 276 of 885

User Guide - Automation 26 July, 2018

DiagramFrame·

EmbeddedElement·

Entity·

EntryPoint·

Event·

ExceptionHandler·

ExitPoint·

ExpansionNode·

ExpansionRegion·

Feature·

GUIElement·

InteractionFragment·

InteractionOccurrence·

InteractionState·

Interface·

InterruptibleActivityRegion·

Issue·

Node·

Note·

Object·

Package·

Parameter·

Part·

Port·

ProvidedInterface·

(c) Sparx Systems 2018 Page 277 of 885

User Guide - Automation 26 July, 2018

Report·

RequiredInterface·

Requirement·

Screen·

Sequence·

State·

StateNode·

Synchronization·

Text·

TimeLine·

UMLDiagram·

UseCase·

Version StringNotes: Read/WriteThe version of the element.

Visibility StringNotes: Read/WriteThe Scope of this element within thecurrent Package.Valid values are: Public, Private,Protected or Package.

(c) Sparx Systems 2018 Page 278 of 885

User Guide - Automation 26 July, 2018

Element Methods

Method Remarks

ApplyGroupLock(stringaGroupName)

BooleanNotes: Applies a group lock to theelement object, for the specified group,on behalf of the current user.Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use 'GetLastError()' toretrieve error information.Parameters:

aGroupName: String - the name of the·

user group for which to set the grouplock

ApplyUserLock()

BooleanNotes: Applies a user lock to the elementobject for the current user.Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use 'GetLastError()' toretrieve error information.

Clone () LDISPATCHNotes: Inserts a copy of the selected

(c) Sparx Systems 2018 Page 279 of 885

User Guide - Automation 26 July, 2018

element under the same parent as theselected element.Returns the newly-created element.

CreateAssociationClass(longConnectorID)

BooleanNotes: Makes this element anAssociationClass of the Association withthe provided Connector ID; the returnvalue indicates whether the functionsucceeded in converting the element to anAssociationClass.AssociationClasses are created onlywhere:

The current element is valid·

The current element is a Class·

The current element is not already an·

AssociationClassThe specified connector exists·

The specified connector is an·

AssociationThe specified connector is not already·

in an AssociationClass pairThe current element is not at either end·

of the specified connectorParameters:

ConnectorID: Long - the Connector ID·

of an Association connector

(c) Sparx Systems 2018 Page 280 of 885

User Guide - Automation 26 July, 2018

DeleteLinkedDocument()

BooleanNotes: Removes the Linked Documentfor the element. This method does notdisplay a confirmatory prompt.Returns True if a document was deleted.

GetBusinessRules()

StringNotes: Read Only.Returns all the Business Rules for theelement.

GetDecisionTable()

StringNotes: Provides read-only access to adecision table XML string.Returns the XML data for the deciontable as a string.

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

GetLinkedDocument()

StringNotes: Returns a string value containingthe element's linked document contents,in Rich Text Format.If the element contains no linkeddocument, an empty string is returned.

(c) Sparx Systems 2018 Page 281 of 885

User Guide - Automation 26 July, 2018

GetRelationSet(EnumRelationSetTypeType)

StringNotes: Returns a string containing acomma-separated list of ElementIDs ofdirectly- and indirectly -related elementsbased on the given type.Recurses using the same relation type onall elements it finds, retrieving alldependencies and sub-dependencies ofthe current element; for example, Object1depends on Object2, which depends onObject3, therefore this method returnsObject2 and Object3.To obtain only the direct relationships ofthe element, use the Connector collectioninstead.

GetStereotypeList()

StringNotes: Returns a comma-separated list ofstereotypes allied to this element.

HasStereotype(stringStereotype)

BooleanNotes: Returns true if the current elementhas the specified stereotype applied to it.Accepts either qualified or unqualifiedstereotype names; for example, 'block' or'SysML1.3::block'.Parameters:

(c) Sparx Systems 2018 Page 282 of 885

User Guide - Automation 26 July, 2018

Stereotype: String - the name of the·

stereotype to search for

IsAssociationClass

BooleanNotes: Returns whether or not the currentelement is an AssociationClass.

LoadLinkedDocument(stringFilename)

BooleanNotes: Loads the document from thespecified file into the element's linkeddocument.Parameters:

FileName: String - the name of the file·

from which to load the document; bothRTF and DOCX input formats aresupported

Refresh() VoidNotes: Refreshes the element features inthe Project Browser.Usually called after adding or deletingattributes or methods, when the userinterface is required to be updated aswell.

ReleaseUserLock()

BooleanNotes: Releases a user lock or group lockon the element object.

(c) Sparx Systems 2018 Page 283 of 885

User Guide - Automation 26 July, 2018

Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use GetLastError() toretrieve error information.

SaveLinkedDocument(string Filename)

BooleanNotes: Saves the linked document for thiselement to the specified file. ReturnsFalse if the element does not have aLinked document or fails to save the file.Parameters:

FileName: String - the name of the file·

to save to diskThe output format will be determinedby the file's extension - currently rtf,docx and pdf are supported; if aninvalid extension is used, it will writethe file in RTF format regardless of theextension

SetAppearance(longScope, longItem, longValue)

VoidNotes: Sets the visual appearance of theelement.Parameters:

Scope: Long - Scope of appearance set·

to modify1 - Base (Default appearance acrossentire model)To set appearance for the element

(c) Sparx Systems 2018 Page 284 of 885

User Guide - Automation 26 July, 2018

(diagram object) in a selected diagramonly, see Setting The Style in theDiagramObject Class topicItem: Long - Appearance feature to·

modify0 - Background color1 - Font Color2 - Border Color3 - Border WidthValue: Long - Value to set appearance·

to

SetCompositeDiagram()

BooleanNotes: Sets the composite diagram of theelement.Parameters:

GUID: String - the GUID of the·

composite diagram; a blank GUID willremove the link to the compositediagram

SetCreated(Date NewVal)

VoidNotes: DeprecatedThis method is no longer supported.

SetModified(DateNewVal)

VoidNotes: DeprecatedThis method is no longer supported.

(c) Sparx Systems 2018 Page 285 of 885

User Guide - Automation 26 July, 2018

SynchConstraints(stringProfile, stringStereotype)

BooleanNotes: Synchronizes the constraints of aUML Profile item for this element, onlyif the specified stereotype has beenapplied.Parameters:

Profile: String - Name of the profile·

that contains the stereotypeStereotype: String - Name of the profile·

stereotype for which the defaultconstraints are to be synchronized

SynchTaggedValues(stringProfile, stringStereotype)

BooleanNotes: Synchronizes the Tagged Valuesof a UML Profile item for this element,only if the specified stereotype has beenapplied.Parameters:

Profile: String - Name of the profile·

that contains the stereotypeStereotype: String - Name of the profile·

stereotype for which the default tagsare to be synchronized

UnlinkFromAssociation

BooleanNotes: Performs the opposite ofCreateAssociationClass().

(c) Sparx Systems 2018 Page 286 of 885

User Guide - Automation 26 July, 2018

Update() BooleanNotes: Updates the current element objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 287 of 885

User Guide - Automation 26 July, 2018

File Class

A File represents an associated file for an element. Files areaccessed through the Element Files collection.

Associated table in .EAP file

t_objectfiles

File Attributes

Attribute Remarks

FileDate StringNotes: Read/WriteThe file date when the entry was created.

Name StringNotes: Read/WriteThe file name can be a logical file or areference to a web address (using http://).

Notes StringNotes: Read/Write

(c) Sparx Systems 2018 Page 288 of 885

User Guide - Automation 26 July, 2018

Notes about the file.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Size StringNotes: Read/WriteThe file size.

Type StringNotes: Read/WriteThe file type.

File Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

(c) Sparx Systems 2018 Page 289 of 885

User Guide - Automation 26 July, 2018

Update() BooleanNotes: Updates the current File objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 290 of 885

User Guide - Automation 26 July, 2018

Issue (Maintenance) Class

An Issue is either a Change or a Defect, is associated withthe containing element, and is accessed through the Issuescollection of an element.

Associated table in .EAP file

t_objectproblems

Issue Attributes

Attribute Remarks

DateReported DateNotes: Read/WriteThe date the issue was reported.

DateResolved

DateNotes: Read/WriteThe date the issue was resolved.

ElementID LongNotes: Read/Write

(c) Sparx Systems 2018 Page 291 of 885

User Guide - Automation 26 July, 2018

The ID of the element associated withthis issue.

Name StringNotes: Read/WriteThe Issue name; that is, the Issue itself.

Notes StringNotes: Read/WriteThe Issue description.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Priority StringNotes: Read/WriteThe priority of the Issue - Low, Mediumor High.

Reporter StringNotes: Read/WriteThe user ID of the person reporting theissue.

Resolver String

(c) Sparx Systems 2018 Page 292 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe user ID of the person resolving theissue.

ResolverNotes

StringNotes: Read/WriteNotes entered by the resolver aboutresolution of the Issue.

Severity StringNotes: Read/WriteThe Issue severity - Low, Medium orHigh.

Status StringNotes: Read/WriteThe current status of the issue.

Type VariantNotes: Read/WriteThe Issue type - Defect, Change, Issue orToDo.

Version StringNotes: Read/WriteThe version associated with the issue.Note that this method is only available

(c) Sparx Systems 2018 Page 293 of 885

User Guide - Automation 26 July, 2018

through a Dispatch interface.Object ob = Issue;Print ob.Version;

Issue Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current Issue objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 294 of 885

User Guide - Automation 26 July, 2018

Metric Class

A Metric is a named item with a weighting that can beassociated with an element for purposes of building metricsabout the model. Metrics are accessed through the ElementMetrics collection.

Associated table in .EAP file

t_objectmetrics

Metric Attributes

Attribute Remarks

Name StringNotes: Read/WriteThe name of the metric.

Notes StringNotes: Read/WriteNotes about this metric.

ObjectType ObjectType

(c) Sparx Systems 2018 Page 295 of 885

User Guide - Automation 26 July, 2018

Notes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Type StringNotes: Read/WriteThe metric type.

Weight LongNotes: Read/WriteA user-defined weighting for estimationor metric purposes.

Metric Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current Metric objectafter modification or appending a new

(c) Sparx Systems 2018 Page 296 of 885

User Guide - Automation 26 July, 2018

item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 297 of 885

User Guide - Automation 26 July, 2018

Requirement Class

An Element Requirement object holds information about therequirements of an element in the context of the model.Requirements can be accessed using the ElementRequirements collection.

Associated table in .EAP file

t_objectrequires

Requirement Attributes

Attribute Remarks

Difficulty StringNotes: Read/WriteThe estimated difficulty of implementingthe requirement.

LastUpdate DateNotes: Read/WriteThe date the requirement was lastupdated.

(c) Sparx Systems 2018 Page 298 of 885

User Guide - Automation 26 July, 2018

Name StringNotes: Read/WriteThe requirement itself.

Notes StringNotes: Read/WriteFurther notes on the requirement.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

ParentID LongNotes: Read onlyThe ElementID of the element to whichthis requirement applies.

Priority StringNotes: Read/WriteThe assigned priority of the requirement.

RequirementID

LongNotes: Read onlyA local ID for this requirement.

Stability String

(c) Sparx Systems 2018 Page 299 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe estimated stability of therequirement.This is an indication of the probability ofthe requirement - or understanding of therequirement - changing. High stabilityindicates a low probability of therequirement changing.

Status StringNotes: Read/WriteThe current status of the requirement.

Type StringNotes: Read/WriteThe requirement type.

Requirement Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

(c) Sparx Systems 2018 Page 300 of 885

User Guide - Automation 26 July, 2018

Update() BooleanNotes: Updates the current Requirementobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 301 of 885

User Guide - Automation 26 July, 2018

Resource Class

An Element Resource is a named person/task pair withtiming constraints and percent complete indicators. Use thisto manage the work associated with delivering an Element.

Associated table in .EAP file

t_objectresources

Resource Attributes

Attribute Description

ActualHours LongNotes: Read/WriteThe time already expended on the task, inhours, days or other units.

DateEnd DateNotes: Read/WriteThe expected end date.

DateStart Date

(c) Sparx Systems 2018 Page 302 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe date to start work.

ExpectedHours

LongNotes: Read/WriteThe total expected time the task mightrun, in hours, days or other units.

History StringNotes: Read/WriteGets or sets history text.

Name StringNotes: Read/WriteThe name of the resource (for example, aperson's name).

Notes StringNotes: Read/WriteDescriptive notes.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

PercentComp Long

(c) Sparx Systems 2018 Page 303 of 885

User Guide - Automation 26 July, 2018

lete Notes: Read/WriteThe current percent complete figure.

Role StringNotes: Read/WriteThe role the resource plays inimplementing the element.

Time LongNotes: Read/WriteThe time expected to complete the task; anumeric indicating the number of days.

Resource Methods

Method Description

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.This function is rarely used as anexception is thrown when an error occurs.

Update() Boolean

(c) Sparx Systems 2018 Page 304 of 885

User Guide - Automation 26 July, 2018

Notes: Update the current Resourceobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 305 of 885

User Guide - Automation 26 July, 2018

Risk Class

A Risk object represents a named risk associated with anelement, it is used for project management purposes. Riskscan be accessed through the Element Risks collection.

Associated table in .EAP file

t_objectrisks

Risk Attributes

Attribute Description

Name StringNotes: Read/WriteThe name of the risk.

Notes StringNotes: Read/WriteFurther notes describing the risk.

ObjectType ObjectTypeNotes: Read only

(c) Sparx Systems 2018 Page 306 of 885

User Guide - Automation 26 July, 2018

Distinguishes objects referenced througha Dispatch interface.

Type StringNotes: Read/WriteThe risk type associated with thiselement.

Weight LongNotes: Read/WriteA weighting for estimation or metricpurposes.

Risk Methods

Method Description

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the current Risk objectafter modification or appending a new

(c) Sparx Systems 2018 Page 307 of 885

User Guide - Automation 26 July, 2018

item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 308 of 885

User Guide - Automation 26 July, 2018

Scenario Class

A Scenario corresponds to a Collaboration or Use Caseinstance. Each Scenario is a path of execution through thelogic of a Use Case. Scenarios can be added to using theElement Scenarios collection.

Associated table in .EAP file

t_objectscenarios

Scenario Attributes

Attribute Description

Name StringNotes: Read/WriteThe Scenario name.

Notes StringNotes: Read/WriteA description of the Scenario, usuallycontaining the steps to execute thescenario.

(c) Sparx Systems 2018 Page 309 of 885

User Guide - Automation 26 July, 2018

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

ScenarioGUID

StringNotes: Read/WriteA unique ID for the Scenario, used toidentify the Scenario unambiguouslywithin a model.

Steps Collection of ScenarioStep ClassNotes: Read onlyA collection of step objects for thisScenario.Use the 'AddNew' and 'Delete' functionsto manage steps. 'AddNew' passes thestep name and '1' as the type for an actorstep.

Type StringNotes: Read/WriteThe scenario type (for example, BasicPath).

Weight LongNotes: Read/Write

(c) Sparx Systems 2018 Page 310 of 885

User Guide - Automation 26 July, 2018

Currently used to position scenarios inthe scenario list (that is, List Position).

XMLContent StringNotes: Read/WriteA structured field that can containscenario details in XML format. Itis recommended that you use the 'Steps'collection to read or modify this field.

Scenario Methods

Method Description

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the current Scenario objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for more

(c) Sparx Systems 2018 Page 311 of 885

User Guide - Automation 26 July, 2018

information.

(c) Sparx Systems 2018 Page 312 of 885

User Guide - Automation 26 July, 2018

ScenarioExtension Class

ScenarioExtension Attributes

Attribute Description

ExtensionGUID

StringNotes: Read/WriteA unique GUID for this Extension.

Join StringNotes: Read/WriteThe GUID of the step where thisExtension rejoins the Scenario.

JoiningStep ScenarioStepNotes: Read onlyThe actual step where this Extensionrejoins the Scenario, if any.

Level StringNotes: Read onlyThe number of this Extension as shownin the scenario editor. This is derivedfrom the value of Pos for this object andthe owning step.

(c) Sparx Systems 2018 Page 313 of 885

User Guide - Automation 26 July, 2018

Name StringNotes: Read/WriteThe Extension name. This should matchthe name of the linked scenario.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Pos LongNotes: Read/WriteThe position of the Extension in theExtensions list.

Scenario ScenarioNotes: Read onlyThe scenario that is executed as analternative path for this Extension.

ScenarioExtension Methods

Method Description

(c) Sparx Systems 2018 Page 314 of 885

User Guide - Automation 26 July, 2018

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the currentScenarioExtension object aftermodification or appending a new item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 315 of 885

User Guide - Automation 26 July, 2018

ScenarioStep Class

ScenarioStep Attributes

Attribute Description

Extensions Collection of ScenarioExtensionNotes: Read onlyA collection of ScenarioExtension objectsthat specify how the scenario is extendedfrom this step. The arguments to'AddNew' should match the name andGUID of the alternative scenario beinglinked to.

Level StringNotes: Read onlyThe number of this Step as shown in thescenario editor. This is derived from thevalue of Pos.

Link StringNotes: Read/WriteThe GUID of a Use Case that is relevantto this step.

(c) Sparx Systems 2018 Page 316 of 885

User Guide - Automation 26 July, 2018

LinkedElement

ElementNotes: Read onlyThe actual element specified by Link, ifany.

Name StringNotes: Read/WriteThe step name.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Pos LongNotes: Read/WriteThe position of the 'Step' in the 'ScenarioStep' list.

Results StringNotes: Read/WriteAny results that are given from this step.

State StringNotes: Read/WriteA description of the state the systementers when this Step is executed.

(c) Sparx Systems 2018 Page 317 of 885

User Guide - Automation 26 July, 2018

StepGUID StringNotes: Read/WriteA unique GUID for this Step.

StepType ScenarioStepTypeNotes: Read/WriteIdentifies whether this step is beingperformed by a user or the system.

Uses StringNotes: Read/WriteThe input and requirements that arerelevant to this step.

UsesElementList

Collection of ElementNotes: Read onlyIndicates that the 'StructuredSpecification' tab 'Uses' field is a linkedelement list.

ScenarioStep Methods

Method Description

(c) Sparx Systems 2018 Page 318 of 885

User Guide - Automation 26 July, 2018

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current ScenarioStepobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 319 of 885

User Guide - Automation 26 July, 2018

TaggedValue Class

A TaggedValue is a named property and value associatedwith an element. Tagged Values can be accessed through theTaggedValues collection.

Associated table in .EAP file

t_objectproperties

TaggedValue Attributes

Attribute Description

ElementID LongNotes: Read/WriteThe local ID of the associated element.

FQName StringNotes: Read onlyThe fully-qualified name of the tag.

Name StringNotes: Read/Write

(c) Sparx Systems 2018 Page 320 of 885

User Guide - Automation 26 July, 2018

The name of the tag.

Notes StringNotes: Read/WriteFurther descriptive notes about this tag.If 'Value' is set to '<memo>', then 'Notes'should contain the actual Tagged Valuecontent.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

PropertyGUID

StringNotes: Read/WriteThe global ID of the tag.

PropertyID LongNotes: Read onlyThe local ID of the tag.

Value StringNotes: Read/WriteThe value assigned to this tag.This field has a 255 character limit. If thevalue is greater than 255 characters long,

(c) Sparx Systems 2018 Page 321 of 885

User Guide - Automation 26 July, 2018

set the value to "<memo>" and insert thebody of text in the 'Notes' attribute.When reading existing Tagged Values, if'Value'' = "<memo>" then the developershould read the actual body of text fromthe 'Notes' attribute.

TaggedValue Methods

Method Description

GetAttribute(stringpropName)

StringNotes: Returns the text of a single namedproperty within a structured TaggedValue.Parameters:

propName: String - the name of the·

property for which the text is beingreturned

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

(c) Sparx Systems 2018 Page 322 of 885

User Guide - Automation 26 July, 2018

HasAttributes()

BooleanNotes: Returns True if the Tagged Valueis a structured Tagged Value with one ormore properties.

SetAttribute(stringpropName,stringpropValue)

BooleanNotes: Sets the text of a single namedproperty within a structured TaggedValue.Parameters:

propName: String - the name of the·

property for which the text is being setpropValue: the value of the property·

Update() BooleanNotes: Updates the current TaggedValueobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 323 of 885

User Guide - Automation 26 July, 2018

Test Class

A Test is a single Test Case applied to an element. Tests areadded and accessed through the Element Tests collection.

Associated table in .EAP file

t_objecttests

Test Attributes

Attribute Description

AcceptanceCriteria

StringNotes: Read/WriteThe acceptance criteria for successfulexecution.

CheckedBy StringNotes: Read/WriteUser ID of the person confirming theresults.

Class Long

(c) Sparx Systems 2018 Page 324 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe test Class:1 = Unit Test2 = Integration Test3 = System Test4 = Acceptance Test5 = Scenario Test6 = Inspection Test

DateRun DateNotes: Read/WriteThe date the test was last run.

Input StringNotes: Read/WriteInput data for the test.

Name StringNotes: Read/WriteThe test name.

Notes StringNotes: Read/WriteDetailed notes about test to be carriedout.

(c) Sparx Systems 2018 Page 325 of 885

User Guide - Automation 26 July, 2018

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

RunBy StringNotes: Read/WriteThe user ID of the person conducting thetest.

Status StringNotes: Read/WriteThe current status of the test.

TestResults VariantNotes: Read/WriteResults of test.

Type StringNotes: Read/WriteThe test type, such as Load orRegression.

Test Methods

(c) Sparx Systems 2018 Page 326 of 885

User Guide - Automation 26 July, 2018

Method Description

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the current Test objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 327 of 885

User Guide - Automation 26 July, 2018

Element Features Package

The ElementFeatures Package contains descriptions of themodel interfaces that enable access to operations andattributes, and their associated Tagged Values andconstraints.

This diagram illustrates the components associated withelement features. These include attributes and methods, andtheir associated constraints and Tagged Values. It alsoincludes the Parameter object that defines the argumentsassociated with an operation (Method).

(c) Sparx Systems 2018 Page 328 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 329 of 885

User Guide - Automation 26 July, 2018

Attribute Class

An attribute corresponds to a UML Attribute. It containsfurther collections for constraints and Tagged Values.Attributes are accessed from the element Attributescollection.

Associated table in .EAP file

t_attribute

Attribute Attributes

Attribute Remarks

Alias StringNotes: Read/WriteContains the (optional) 'Alias' propertyfor this attribute. This can be usedinterchangeably with the Style attribute.

AllowDuplicates

BooleanNotes: Read/WriteIndicates if duplicates are allowed in thecollection.

(c) Sparx Systems 2018 Page 330 of 885

User Guide - Automation 26 July, 2018

If the attribute represents a databasecolumn this, when set, represents the 'NotNull' option.

AttributeGUID

StringNotes: Read onlyA globally unique ID for the currentattribute. This attribute is systemgenerated.

AttributeID LongNotes: Read onlyThe local ID number of the attribute.

ClassifierID LongNotes: Read/WriteThe classifier ID, if appropriate,indicating the base type associated withthe attribute, if not a primitive type.

Container StringNotes: Read/WriteThe container type.

Containment StringNotes: Read/WriteThe type of containment - Not Specified,

(c) Sparx Systems 2018 Page 331 of 885

User Guide - Automation 26 July, 2018

By Reference or By Value.

Constraints CollectionNotes: Read onlyA collection of AttributeConstraintobjects, used to access and manageconstraints associated with this attribute.

Default StringNotes: Read/WriteThe initial value assigned to this attribute.

FQStereotype StringNotes: Read OnlyThe fully-qualified stereotype name in theformat "Profile::Stereotype". One or morefully-qualified stereotype names can beassigned to StereotypeEx.

IsCollection BooleanNotes: Read/WriteIndicates if the current feature is acollection or not. If the attributerepresents a database column this, whenset, represents a Foreign Key.

IsConst Boolean

(c) Sparx Systems 2018 Page 332 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteA flag indicating if the attribute is Constor not.

IsDerived BooleanNotes: Read/WriteIndicates if the attribute is derived (thatis, a calculated value).

IsID BooleanNotes: Read/WriteIndicates if the attribute uniquelyidentifies an instance of the containingClass, or not.

IsOrdered BooleanNotes: Read/WriteIndicates if a collection is ordered or not.If the attribute represents a databasecolumn this, when set, represents aPrimary Key.

IsStatic BooleanNotes: Read/WriteIndicates if the current attribute is a staticfeature or not. If the attribute represents adatabase column this, when set,represents the 'Unique' option.

(c) Sparx Systems 2018 Page 333 of 885

User Guide - Automation 26 July, 2018

Length StringNotes: Read/WriteThe attribute length, where applicable.

LowerBound StringNotes: Read/WriteA value for the collection lowerboundary.

Name StringNotes: Read/WriteThe attribute name.

Notes StringNotes: Read/WriteFurther notes on this attribute.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

ParentID LongNotes: Read onlyReturns the ElementID of the elementthat this attribute is a part of.

(c) Sparx Systems 2018 Page 334 of 885

User Guide - Automation 26 July, 2018

Pos LongNotes: Read/WriteThe position of the attribute in the Classattribute list.

Precision StringNotes: Read/WriteThe precision value.

RedefinedProperty

StringNotes: Read/WriteCorresponds to the 'Redefined Property'field on the 'Detail' page of the attribute'Properties' dialog, or the UMLredefinedProperty attribute.Contains a comma separated list ofGUIDs.

Scale StringNotes: Read/WriteThe scale value.

Stereotype StringNotes: Read/WriteSets or gets the stereotype for thisattribute.

(c) Sparx Systems 2018 Page 335 of 885

User Guide - Automation 26 July, 2018

StereotypeEx StringNotes: Read/WriteProvides all the applied stereotypes of theattribute, in a comma-separated list.Reading the value will provide thestereotype name only; assigning the valueaccepts either fully-qualified or simplenames.

Style StringNotes: Read/WriteContains the (optional) Alias property forthis attribute. This can be usedinterchangeably with the Alias attribute.

StyleEx StringNotes: Read/WriteAdvanced style settings, reserved for theuse of Sparx Systems.

SubsettedProperty

StringNotes: Read/WriteCorresponds to the 'Subsetted Property'field on the 'Detail' page of the attribute'Properties' dialog, or the UMLsubsettedProperty attribute.Contains a comma separated list of

(c) Sparx Systems 2018 Page 336 of 885

User Guide - Automation 26 July, 2018

GUIDs.

TaggedValues

Collection of type AttributeTagNotes: Read onlyA collection of AttributeTag objects, usedto access and manage Tagged Valuesassociated with this attribute.

TaggedValuesEx

Collection of type TaggedValueNotes: Read onlyA collection of TaggedValue objectsbelonging to the current attribute and theTaggedValuesEx property of itsclassifier.

Type StringNotes: Read/WriteThe attribute type (by name; also seeClassifierID).

UpperBound StringNotes: Read/WriteA value for the collection upperboundary.

Visibility StringNotes: Read/Write

(c) Sparx Systems 2018 Page 337 of 885

User Guide - Automation 26 July, 2018

Identifies the scope of the attribute -Private, Protected, Public or Package.

Attribute Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the current attributeobject after modifying or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 338 of 885

User Guide - Automation 26 July, 2018

AttributeConstraint Class

An AttributeConstraint is a constraint associated with thecurrent Attribute.

Associated table in .EAP file

t_attributeconstraints

AttributeConstraint Attributes

Attribute Remarks

AttributeID LongNotes: Read/WriteThe ID of the attribute this constraintapplies to.

Name StringNotes: Read/WriteThe name of the constraint.

Notes StringNotes: Read/Write

(c) Sparx Systems 2018 Page 339 of 885

User Guide - Automation 26 July, 2018

Descriptive notes about the constraint.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Type StringNotes: Read/WriteThe type of constraint.

AttributeConstraint Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the currentAttributeConstraint object aftermodification or appending a new item.If False is returned, check the

(c) Sparx Systems 2018 Page 340 of 885

User Guide - Automation 26 July, 2018

'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 341 of 885

User Guide - Automation 26 July, 2018

AttributeTag Class

An AttributeTag represents a Tagged Value associated withan attribute.

Associated table in .EAP file:

t_attributetag

AttributeTag Attributes:

Attribute Remarks

AttributeID LongNotes: Read/WriteThe local ID of the attribute associatedwith this Tagged Value.

FQName StringNotes: Read onlyThe fully-qualified name of the tag.

Name StringNotes: Read/Write

(c) Sparx Systems 2018 Page 342 of 885

User Guide - Automation 26 July, 2018

The name of the tag.

Notes StringNotes: Read/WriteFurther descriptive notes about this tag.If 'Value' is set to '<memo>', then 'Notes'should contain the actual Tagged Valuecontent.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

TagGUID StringNotes: Read/WriteA globally unique ID for this TaggedValue.

TagID LongNotes: Read onlyThe local ID to identify the TaggedValue.

Value StringNotes: Read/WriteThe value assigned to this tag.

(c) Sparx Systems 2018 Page 343 of 885

User Guide - Automation 26 July, 2018

This field has a 255 character limit. If thevalue is greater than 255 characters long,set the value to "<memo>" and insert thebody of text in the 'Notes' attribute.When reading existing Tagged Values, if'Value' = "<memo>" then the developershould read the actual body of text fromthe 'Notes' attribute.

AttributeTag Methods:

Method Remarks

GetAttribute(stringpropName)

StringNotes: Returns the text of a single namedproperty within a structured TaggedValue.

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.This function is rarely used as anexception is thrown when an error occurs.

(c) Sparx Systems 2018 Page 344 of 885

User Guide - Automation 26 July, 2018

HasAttributes()

BooleanNotes: Returns True if the Tagged Valueis a structured Tagged Value with one ormore properties.

SetAttribute(stringpropName,stringpropValue)

BooleanNotes: Sets the text of a single namedproperty within a structured TaggedValue.

Update() BooleanNotes: Updates the current AttributeTagobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 345 of 885

User Guide - Automation 26 July, 2018

CustomProperties Collection

The CustomProperties collection contains 0 or moreCustomProperties associated with the current element.These properties provide advanced UML configurationoptions, and must not be added to or deleted. The value ofeach property can be set.

CustomProperty

Attribute Remarks

Name StringNotes: Read onlyThe CustomProperty name.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Value StringNotes: Read/WriteThe value associated with thisCustomProperty. This can be:

A string·

(c) Sparx Systems 2018 Page 346 of 885

User Guide - Automation 26 July, 2018

The boolean values True or False, or·

An enumeration value from a defined·

listThe UML 2.5 specification in generalprovides information on the kinds ofenumeration relevant here.

Notes

The number and type of properties vary depending on the·

actual element

(c) Sparx Systems 2018 Page 347 of 885

User Guide - Automation 26 July, 2018

EmbeddedElements Collection

In UML 2.5 an element can have one or more embeddedelements such as Ports, Pins, Parameters or ObjectNodes.These are attached to the boundary of the host element andcannot be moved off the element. They are owned by theirhost element. This collection gives easy access to the set ofelements embedded on the surface of an element. Note thatsome embedded elements can have their own embeddedelement collection (for example, Ports can have Interfacesembedded on them).

The EmbeddedElements collection contains Elementobjects.

Example

(c) Sparx Systems 2018 Page 348 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 349 of 885

User Guide - Automation 26 July, 2018

Method Class

A method represents a UML operation. It is accessed fromthe Element Methods collection and includes collections forparameters, constraints and Tagged Values.

Associated table in .EAP file

t_operation

Method Attributes

Attribute Remarks

Abstract BooleanNotes: Read/WriteA flag indicating if the method is abstract(1) or not (0).

Behavior StringNotes: Read/WriteSome further explanatory behavior notes(for example, pseudocode).In earlier releases of Enterprise Architectthis attribute had the UK/Australian

(c) Sparx Systems 2018 Page 350 of 885

User Guide - Automation 26 July, 2018

spelling 'Behaviour'; this is still presentfor backwards compatibility, but pleasenow use the 'Behavior' attribute forconsistency.

ClassifierID StringNotes: Read/WriteThe Classifier ID that applies to theReturnType.

Code StringNotes: Read/WriteAn optional field to hold the method code(used for the 'Initial Code' field).

Concurrency VariantNotes: Read/WriteIndicates the concurrency type of themethod.

FQStereotype StringNotes: Read OnlyThe fully-qualified stereotype name in theformat "Profile::Stereotype". One or morefully-qualified stereotype names can beassigned to StereotypeEx.

IsConst Boolean

(c) Sparx Systems 2018 Page 351 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteA flag indicating that the method isConst.

IsLeaf BooleanNotes: Read/WriteA flag to indicate if the method is a Leaf(cannot be overridden).

IsPure BooleanNotes: Read/WriteA flag indicating that the method isdefined as 'Pure' in C++.

IsQuery BooleanNotes: Read/WriteA flag to indicate if the method is a query(that is, does not alter Class variables).

IsRoot BooleanNotes: Read/WriteA flag to indicate if the method is Root.

IsStatic BooleanNotes: Read/WriteA flag to indicate a static method.

(c) Sparx Systems 2018 Page 352 of 885

User Guide - Automation 26 July, 2018

IsSynchronized

BooleanNotes: Read/WriteA flag indicating a Synchronized methodcall.

MethodGUID

StringNotes: Read/WriteA globally unique ID for the currentmethod. This is system generated.

MethodID LongNotes: Read onlyA local ID for the current method, onlyvalid within this .eap file.

Name StringNotes: Read/WriteThe method name.

Notes StringNotes: Read/WriteDescriptive notes on the method.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

(c) Sparx Systems 2018 Page 353 of 885

User Guide - Automation 26 July, 2018

Parameters Collection ClassNotes: Read onlyThe Parameters collection for the currentmethod, used to add and access parameterobjects for the current method.

ParentID LongNotes: Read onlyReturns the ElementID of the elementthat this method belongs to.

Pos LongNotes: Read/WriteSpecifies the position of the methodwithin the set of operations defined for aClass.

PostConditions

Collection ClassNotes: Read onlyThe PostConditions (constraints) as theyapply to this method. This returns aMethodConstraint object of type 'post'.

PreConditions

Collection ClassNotes: Read onlyThe PreConditions (constraints) as theyapply to this method. This returns a

(c) Sparx Systems 2018 Page 354 of 885

User Guide - Automation 26 July, 2018

MethodConstraint object of type 'pre'.

ReturnIsArray

BooleanNotes: Read/WriteA flag to indicate that the return value isan array.

ReturnType StringNotes: Read/WriteThe return type for the method; this canbe a primitive data type or a Class orInterface type.

StateFlags StringNotes: Read/WriteSome flags as applied to methods in Stateelements.

Stereotype StringNotes: Read/WriteThe method stereotype (optional).

StereotypeEx StringNotes: Read/WriteAll the applied stereotypes of the methodin a comma-separated list. Reading thevalue will provide the stereotype name

(c) Sparx Systems 2018 Page 355 of 885

User Guide - Automation 26 July, 2018

only; assigning the value accepts eitherfully-qualified or simple names.

Style StringNotes: Read/WriteContains the Alias property for thismethod.

StyleEx StringNotes: Read/WriteAdvanced style settings, reserved for theuse of Sparx Systems.

TaggedValues

Collection Class of type MethodTag ClassNotes: Read onlyThe TaggedValues collection for thecurrent method. This accesses a list ofMethodTag objects.

Throws StringNotes: Read/WriteException information. Valid input forsetting the Throws is:

GUID String - the GUID of an element·

in the model or a comma-separated listof element GUIDS<none> - removes the existing Throws·

(c) Sparx Systems 2018 Page 356 of 885

User Guide - Automation 26 July, 2018

set

Visibility StringNotes: Read/WriteThe method scope - Public, Protected,Private or Package.

Method Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the current method objectafter modification or appending a newitem.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 357 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 358 of 885

User Guide - Automation 26 July, 2018

MethodConstraint Class

A MethodConstraint is a condition imposed on a method. Itis accessed through either the Method PreConditions orMethod PostConditions collection.

Associated table in .EAP file

t_operationpres and t_operationposts

MethodConstraint Attributes

Attribute Remarks

MethodID LongNotes: Read/WriteThe local ID of the associated method.

Name StringNotes: Read/WriteThe name of the constraint.

Notes StringNotes: Read/Write

(c) Sparx Systems 2018 Page 359 of 885

User Guide - Automation 26 July, 2018

Descriptive notes about this constraint.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Type StringNotes: Read/WriteThe constraint type.

MethodConstraint Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.This function is rarely used as anexception is thrown when an error occurs.

Update() BooleanNotes: Update the currentMethodConstraint object after

(c) Sparx Systems 2018 Page 360 of 885

User Guide - Automation 26 July, 2018

modification or appending a new item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 361 of 885

User Guide - Automation 26 July, 2018

MethodTag Class

A MethodTag is a Tagged Value associated with a method.

Associated table in .EAP file:

t_operationtag

MethodTag Attributes:

Attribute Remarks

FQName StringNotes: Read onlyThe fully-qualified name of the tag.

MethodID LongNotes: Read/WriteThe ID of the associated method.

Name StringNotes: Read/WriteThe tag or name of the property.

(c) Sparx Systems 2018 Page 362 of 885

User Guide - Automation 26 July, 2018

Notes StringNotes: Read/WriteFurther descriptive notes about this tag.If 'Value' is set to '<memo>', then 'Notes'should contain the actual Tagged Valuecontent.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

TagGUID StringNotes: Read/WriteA unique GUID for this Tagged Value.

TagID LongNotes: Read onlyA unique ID for this Tagged Value.

Value StringNotes: Read/WriteThe value assigned to this tag.This field has a 255 character limit. If thevalue is greater than 255 characters long,set the value to "<memo>" and insert thebody of text in the 'Notes' attribute.

(c) Sparx Systems 2018 Page 363 of 885

User Guide - Automation 26 July, 2018

When reading existing Tagged Values, if'Value' = "<memo>" then the developershould read the actual body of text fromthe 'Notes' attribute.

MethodTag Methods:

Method Remarks

GetAttribute(stringpropName)

StringNotes: Returns the text of a single namedproperty within a structured TaggedValue.

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.This function is rarely used as anexception is thrown when an error occurs.

HasAttributes()

BooleanNotes: Returns True if the Tagged Valueis a structured Tagged Value with one ormore properties.

(c) Sparx Systems 2018 Page 364 of 885

User Guide - Automation 26 July, 2018

SetAttribute(stringpropName,stringpropValue)

BooleanNotes: Sets the text of a single namedproperty within a structured TaggedValue.

Update() BooleanNotes: Updates the current MethodTagobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 365 of 885

User Guide - Automation 26 July, 2018

Parameter Class

A Parameter object represents a method argument and isaccessed through the Method Parameters collection.

Associated table in .EAP file

t_operationparams

Parameter Attributes

Attribute Remarks

Alias StringNotes: Read/WriteAn optional alias for this parameter.

ClassifierID StringNotes: Read/WriteA ClassifierID for the parameter, ifknown.

Default StringNotes: Read/Write

(c) Sparx Systems 2018 Page 366 of 885

User Guide - Automation 26 July, 2018

A default value for this parameter.

IsConst BooleanNotes: Read/WriteA flag indicating that the parameter isConst (cannot be altered).

Kind StringNotes: Read/WriteThe parameter kind - in, inout, out, orreturn.

Name StringNotes: Read/WriteThe parameter name; this must be uniquefor a single method.

Notes StringNotes: Read/WriteDescriptive notes.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

OperationID Long

(c) Sparx Systems 2018 Page 367 of 885

User Guide - Automation 26 July, 2018

Notes: Read onlyThe ID of the method associated with thisparameter.

ParameterGUID

StringNotes: Read/WriteA system generated, globally unique IDfor the current Parameter.

Position LongNotes: Read/WriteThe position of the parameter in theargument list.

Stereotype StringNotes: Read/WriteThe first stereotype of the parameter.

StereotypeEx StringNotes: Read/WriteAll the applied stereotypes of theparameter in a comma-separated list.Reading the value will provide thestereotype name only; assigning the valueaccepts either fully-qualified or simplenames.

(c) Sparx Systems 2018 Page 368 of 885

User Guide - Automation 26 July, 2018

Style StringNotes: Read/WriteSome style information.

StyleEx StringNotes: Read/WriteAdvanced style settings, reserved for theuse of Sparx Systems.

TaggedValues

Collection Class of type ParamTag ClassNotes: Read/WriteThe GUID of the parameter with whichthis ParamTag is associated.

Type VariantNotes: Read/WriteThe parameter type; can be a primitivetype or a defined classifier.

Parameter Methods

Method Remarks

GetLastError String

(c) Sparx Systems 2018 Page 369 of 885

User Guide - Automation 26 July, 2018

() Notes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the current Parameterobject after modifying or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 370 of 885

User Guide - Automation 26 July, 2018

ParamTag Class

A ParamTag is a Tagged Value associated with a methodparameter.

Associated table in .EAP file

t_taggedvalue

ParamTag Attributes

Attribute Remarks

ElementGUID

StringNotes: Read/WriteThe GUID of the parameter with whichthis ParamTag is associated.

FQName StringNotes: Read onlyThe fully qualified name of the tag.

ObjectType ObjectTypeNotes: Read only

(c) Sparx Systems 2018 Page 371 of 885

User Guide - Automation 26 July, 2018

Distinguishes objects referenced througha Dispatch interface.

PropertyGUID

StringNotes: Read/WriteA system generated GUID to identify theTagged Value.

Tag StringNotes: Read/WriteThe actual tag name.

Value StringNotes: Read/WriteThe value associated with this tag.

ParamTag Methods

Method Remarks

GetAttribute(stringpropName)

StringNotes: Returns the text of a single namedproperty within a structured TaggedValue.

(c) Sparx Systems 2018 Page 372 of 885

User Guide - Automation 26 July, 2018

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

HasAttributes()

BooleanNotes: Returns True if the Tagged Valueis a structured Tagged Value with one ormore properties.

SetAttribute(stringpropName,stringpropValue)

BooleanNotes: Sets the text of a single namedproperty within a structured TaggedValue.

Update() BooleanNotes: Updates the current ParamTagobject after modifying or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 373 of 885

User Guide - Automation 26 July, 2018

Partitions Collection

A collection of internal element partitions (regions). This iscommonly seen in Activity, State, Boundary, DiagramFrame and similar elements. Not all elements supportpartitions.

This collection contains a set of Partition elements. The setis read/write: information is not saved until the host elementis saved, so ensure that you call the Element.Save methodafter making changes to a Partition.

Partition Attributes

Attribute Remarks

Name StringNotes: Read/WriteThe partition name; this can represent acondition or constraint in some cases.

Note StringNotes: Read/WriteA free text note associated with thispartition.

ObjectType ObjectType

(c) Sparx Systems 2018 Page 374 of 885

User Guide - Automation 26 July, 2018

Notes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Operator StringNotes: Read/WriteAn optional operator value that specifiesthe partition type.

Size StringNotes: Read/WriteThe vertical or horizontal width of thepartition in pixels.

(c) Sparx Systems 2018 Page 375 of 885

User Guide - Automation 26 July, 2018

Properties Class

Properties

Properties Attributes

Attribute Remarks

Count LongNotes: The number of properties that areavailable for this object.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Properties Methods

Property

Method Remarks

Item(object Property

(c) Sparx Systems 2018 Page 376 of 885

User Guide - Automation 26 July, 2018

Index) Notes: Returns a property either by nameor by a zero-based integer offset into thelist of properties.Parameter:

Index: Variant - either a string·

representing the property name or aninteger representing the zero-basedoffset into the property list

Property Attributes

Attribute Remarks

Name StringNotes: Read onlyThe name of the property.The object to which the properties listapplies can have an automation propertywith the same name, in which case thedata accessed through Value is identicalto that obtained through the automationproperty.

ObjectType ObjectTypeNotes: Read only

(c) Sparx Systems 2018 Page 377 of 885

User Guide - Automation 26 July, 2018

Distinguishes objects referenced througha Dispatch interface.

Type PropTypeNotes: Read onlyProvides an indication of what sort ofdata is going to be stored by thisproperty. This restriction can be furtherdefined by the Validation attribute.

Validation StringNotes: Read onlyAn optional string that is used to validateany data that is passed to the Valueattribute. This string is used by theprogrammer at run time to provide anindication of what is expected, and byEnterprise Architect to ensure that thesubmitted data is appropriate.

Value VariantNotes: Read/writeThe value of the property as defined inthe other fields.

(c) Sparx Systems 2018 Page 378 of 885

User Guide - Automation 26 July, 2018

TemplateParameter Class

A TemplateParameter for a template signature specifies aformal parameter that will be substituted by an actualparameter (or the default) in a TemplateBinding relationshipon a Class element.

Associated table in .EAP file

t_xref

TemplateParameter Attributes

Attribute Remarks

Constraint StringNotes: Read/WriteThe name of the Classifier that acts as theconstraint value.

Default StringNotes: Read/WriteThe name of the Classifier that acts as thedefault value.

(c) Sparx Systems 2018 Page 379 of 885

User Guide - Automation 26 July, 2018

Name StringNotes: Read/WriteThe name of the Template Parameter.

ObjectType ObjectTypeNotes: Read OnlyDistinguishes objects referenced througha Dispatch interface.

TemplateParameterID

StringNotes: Read OnlyThe Enterprise Architect Globally UniqueID (GUID) of the current TemplateParameter, in the XrefID column oft_xref.

Type StringNotes: Read/WriteThe Template Parameter type.

TemplateParameter Methods

Method Remarks

GetLastError

(c) Sparx Systems 2018 Page 380 of 885

User Guide - Automation 26 July, 2018

() StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Updates the currentTemplateParameter object aftermodifying or appending a new item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 381 of 885

User Guide - Automation 26 July, 2018

Transitions Collection

The Transitions collection applies only to Timelineelements.

A Timeline element displays 0 or more state transitions atset times on its extent. This collection enables you to accessthe transition set. You can also access additionalinformation by referring to the connectors associated withthe Timeline, and by referencing messages passed betweentimelines. Note that any changes made to elements in thiscollection are only saved when the main element is saved.

Transition Attributes

Attribute Remarks

DurationConstraint

StringNotes: Read/WriteA constraint on the time duration of thetransition.

Event StringNotes: Read/WriteThe event (optional) that initiated thetransition.

(c) Sparx Systems 2018 Page 382 of 885

User Guide - Automation 26 July, 2018

Note StringNotes: Read/WriteA free text note.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

TimeConstraint

StringNotes: Read/WriteA constraint on when the transition has tobe completed.

TxState StringNotes: Read/WriteThe state to transition to, as defined in the'Timeline Properties' dialog.

TxTime StringNotes: Read/Write.The time that the transition occurs. Thevalue depends on a range set in thediagram.

(c) Sparx Systems 2018 Page 383 of 885

User Guide - Automation 26 July, 2018

Connector Package

The Connector Package details how connectors betweenelements are accessed and managed.

This diagram shows the Connector Class, its collections andits relationships to the Element Class. Association Targetroles correspond to member variable names in the sourceinterface. The associated Classes represent the object typeused in each collection.

(c) Sparx Systems 2018 Page 384 of 885

User Guide - Automation 26 July, 2018

Element

Connector

ConnectorConstraint

ConnectorEnd

ConnectorTag

RoleTag

CustomProperty

PropertyProperties

TemplateBinding

1

+CustomProperties

0..*

1

+ConveyedItems 0..*

1

+ClientEnd

1

1

+TemplateBindings

0..*

1

+SupplierEnd

1

1 0..*

1

+TaggedValues

0..*

1

+Constraints

0..*

1

+Properties

1

1

+Connectors 0..*

1

+TaggedValues

0..*

(c) Sparx Systems 2018 Page 385 of 885

User Guide - Automation 26 July, 2018

Connector Class

To represent the various kinds of connectors between UMLelements, you use a Connector object. You can access thisfrom either the Client or Supplier element, using theConnectors collection of that element. When creating a newconnector you assign to it a valid type from this list:

Aggregation·

Assembly·

Association·

Collaboration·

CommunicationPath·

Connector·

ControlFlow·

Delegate·

Dependency·

Deployment·

ERLink·

Generalization·

InformationFlow·

Instantiation·

InterruptFlow·

Manifest·

Nesting·

NoteLink·

(c) Sparx Systems 2018 Page 386 of 885

User Guide - Automation 26 July, 2018

ObjectFlow·

Package·

Realization·

Sequence·

StateFlow·

TemplateBinding·

UseCase·

Associated table in .EAP file

t_connector

Connector Attributes

Attribute Remarks

Alias StringNotes: Read/WriteAn optional alias for this connector.

AssociationClass

ElementNotes: Read OnlyReturns the Association Class element ifthe connector has one; otherwise NULL/.

(c) Sparx Systems 2018 Page 387 of 885

User Guide - Automation 26 July, 2018

ClientEnd ConnectorEndNotes: Read OnlyA pointer to the ConnectorEnd objectrepresenting the source end of therelationship.

ClientID LongNotes: Read/WriteThe ElementID of the element at thesource end of this connector.

Color LongNotes: Read/WriteSets the color of the connector.

ConnectorGUID

StringNotes: Read OnlyA system generated, globally unique IDfor the current connector.

ConnectorID LongNotes: Read OnlyA system generated local identifier forthe current connector.

Constraints CollectionNotes: Read Only

(c) Sparx Systems 2018 Page 388 of 885

User Guide - Automation 26 July, 2018

A collection of constraint objects.

ConveyedItems

Collection of type ElementNotes: Read OnlyReturns a collection of elements that havebeen conveyed.To add another element to the conveyedCollection, use 'AddNew(ElementGUID,NULL)', where'ElementGUID' is the GUID of theelement to be added.

CustomProperties

CollectionNotes: Read OnlyReturns a collection of advancedproperties associated with an element inthe form of CustomProperty objects.

DiagramID LongNotes: Read/WriteThe DiagramID of the connector.

Direction StringNotes: Read/WriteThe connector direction, which can be setto one of:

Unspecified·

(c) Sparx Systems 2018 Page 389 of 885

User Guide - Automation 26 July, 2018

Bi-Directional·

Source -> Destination or·

Destination -> Source·

If the connector is non-navigable, set the'sourceNavigability' and/or'targetNavigability' attributes.

EndPointX LongNotes: Read/WriteThe x-coordinate of the connector's endpoint.Connector end points are specified inCartesian coordinates with the origin tothe top left of the screen.

EndPointY LongNotes: Read/WriteThe y-coordinate of the connector's endpoint.Connector end points are specified inCartesian coordinates with the origin tothe top left of the screen.

EventFlags StringNotes: Read/WriteA structure to hold a variety of flagsconcerned with event signaling on

(c) Sparx Systems 2018 Page 390 of 885

User Guide - Automation 26 July, 2018

messages.

FQStereotype StringNotes: Read OnlyThe fully-qualified stereotype name in theformat "Profile::Stereotype". One or morefully-qualified stereotype names can beassigned to StereotypeEx.

ForeignKeyInformation

StringNotes: Read OnlyReturns the Foreign Key information.

IsLeaf BooleanNotes: Read/WriteA flag indicating that the connector is aleaf.

IsRoot BooleanNotes: Read/WriteA flag indicating that the connector is aroot.

IsSpec BooleanNotes: Read/WriteA flag indicating that the connector is aspecification.

(c) Sparx Systems 2018 Page 391 of 885

User Guide - Automation 26 July, 2018

MessageArguments

StringNotes: Read OnlyThe connector Message arguments.

MetaType StringNotes: Read OnlyThe connector's domain-specific metatype, as defined by an applied stereotypefrom an MDG Technology.

MiscData StringNotes: Read OnlyThis low-level property returns an arrayproviding information about the contentsof the PData x fields.These database fields are not documentedand developers must gain understandingof these fields through their ownendeavors to use this property.MiscData is zero based, therefore:

MiscData(0) corresponds to PData1·

MiscData(1) corresponds to PData2,·

and so on

Name StringNotes: Read/Write

(c) Sparx Systems 2018 Page 392 of 885

User Guide - Automation 26 July, 2018

The connector name.

Notes StringNotes: Read/WriteDescriptive notes about the connector.

ObjectType ObjectTypeNotes: Read OnlyDistinguishes objects referenced througha Dispatch interface.

Properties PropertiesNotes: Returns a list of specializedproperties applicable to the connector thatmight not be available using theautomation model.The properties are purposelyundocumented because of their obscurenature and because they are subject tochange as progressive enhancements aremade to them.

ReturnValueAlias

StringNotes: Shows the 'Return Value Alias'field of the operation.

RouteStyle LongNotes: Read/Write

(c) Sparx Systems 2018 Page 393 of 885

User Guide - Automation 26 July, 2018

The route style.

SequenceNo LongNotes: Read/WriteThe SequenceNo of the connector.

StartPointX LongNotes: Read/WriteThe x-coordinate of the connector's startpoint.Connector end points are specified inCartesian coordinates with the origin tothe top left of the screen.

StartPointY LongNotes: Read/WriteThe y-coordinate of the connector's startpoint.Connector end points are specified inCartesian coordinates with the origin tothe top left of the screen.

StateFlags StringNotes: Read/WriteA structure to hold a variety of flagsconcerned with State signaling onmessages; the list is delimited by

(c) Sparx Systems 2018 Page 394 of 885

User Guide - Automation 26 July, 2018

semi-colons.

Stereotype StringNotes: Read/WriteSets or gets the stereotype for thisconnector end.

StereotypeEx StringNotes: Read/WriteAll the applied stereotypes of theconnector in a comma-separated list.Reading the value will provide thestereotype name only; assigning the valueaccepts either fully-qualified or simplenames.

StyleEx StringNotes: Read/WriteAdvanced style settings; reserved for theuse of Sparx Systems.

Subtype StringNotes: Read/WriteA possible subtype to refine the meaningof the connector.

SupplierEnd ConnectorEnd

(c) Sparx Systems 2018 Page 395 of 885

User Guide - Automation 26 July, 2018

Notes: Read OnlyA pointer to the ConnectorEnd objectrepresenting the target end of therelationship.

SupplierID LongNotes: Read/WriteThe ElementID of the element at thetarget end of this connector.

TaggedValues

Collection of type ConnectorTagNotes: Read OnlyThe collection of ConnectorTag objects.

TemplateBindings

Collection of type TemplateBindingNotes: Read OnlyA collection of TemplateBinding objects.

TransitionAction

StringNotes: Read/WriteSee the Transition topic for appropriatevalues.

TransitionEvent

StringNotes: Read/WriteSee the Transition topic for appropriatevalues.

(c) Sparx Systems 2018 Page 396 of 885

User Guide - Automation 26 July, 2018

TransitionGuard

StringNotes: Read/WriteSee the Transition topic for appropriatevalues.

Type StringNotes: Read/WriteThe connector type; valid types are heldin the t_connectortypes table in the .eapfile.

VirtualInheritance

StringNotes: Read/WriteFor Generalization, indicates if theinheritance is virtual.

Width LongNotes: Read/WriteSpecifies the width of the connector.

Connector Methods

Method Remarks

(c) Sparx Systems 2018 Page 397 of 885

User Guide - Automation 26 July, 2018

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

IsConnectorValid()

BooleanNotes: Queries Enterprise Architect'sinternal relationship validation schema onthe current connector.If False is returned, check the'GetLastError()' function for moreinformation.

Update() BooleanNotes: Updates the currentConnectorObject after modification orappending a new item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 398 of 885

User Guide - Automation 26 July, 2018

ConnectorConstraint Class

A ConnectorConstraint holds information about specialconditions that apply to a connector. It is accessed throughthe Connector Constraints collection.

Associated table in .EAP file

t_connectorconstraints

ConnectorConstraint Attributes

Attribute Remarks

ConnectorID LongNotes: Read/WriteA local ID value (long) - systemgenerated.

Name StringNotes: Read/WriteThe constraint name.

Notes String

(c) Sparx Systems 2018 Page 399 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteNotes about this constraint.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Type StringNotes: Read/WriteThe constraint type.

ConnectorConstraint Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the currentConnectorConstraint object aftermodification or appending a new item.

(c) Sparx Systems 2018 Page 400 of 885

User Guide - Automation 26 July, 2018

If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 401 of 885

User Guide - Automation 26 July, 2018

ConnectorEnd Class

A ConnectorEnd contains information about a single end ofa connector. A ConnectorEnd is accessed from theconnector as either the ClientEnd or SupplierEnd.

Associated table in .EAP file

derived from t_connector

ConnectorEnd Attributes

Attribute Remarks

Aggregation LongNotes: Read/WriteThe type of Aggregation as it applies tothis end; valid values are: 0 = None 1 = Shared 2 = Composite

Alias StringNotes: Read/Write

(c) Sparx Systems 2018 Page 402 of 885

User Guide - Automation 26 July, 2018

An optional alias for this connector end.

AllowDuplicates

BooleanNotes: Read/WriteFor multiplicities greater than 1, indicatesthat duplicate entries are possible.

Cardinality StringNotes: Read/WriteThe cardinality associated with this end.

Constraint StringNotes: Read/WriteA constraint that can be applied to thisconnector end.

Containment StringNotes: Read/WriteThe containment type applied to thisconnector end.

Derived BooleanNotes: Read/WriteIndicates that the value of this end isderived.

DerivedUnio Boolean

(c) Sparx Systems 2018 Page 403 of 885

User Guide - Automation 26 July, 2018

n Notes: Read/WriteIndicates the value of this role derivedfrom the union of all roles that subsetthis.

End StringNotes: Read onlyThe end this ConnectorEnd object appliesto - Client or Supplier.

IsChangeable StringNotes: Read/WriteFlag indicating whether this end ischangeable or not - 'frozen', 'addOnly' ornone.

IsNavigable Note: This property is not usedBooleanNotes: Read/WriteA flag indicating this end is navigablefrom the other end.

Navigable StringNotes: Read/WriteIndicates whether this role of anassociation is navigable from the oppositeclassifier - Navigable, Non-Navigable or

(c) Sparx Systems 2018 Page 404 of 885

User Guide - Automation 26 July, 2018

Unspecified.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Ordering LongNotes: Read/WriteOrdering for this connector end.

OwnedByClassifier

BooleanNotes: Read/WriteIndicates that this Association endcorresponds to an attribute on theopposite end of the Association.

Qualifier StringNotes: Read/WriteA qualifier that can apply to theconnector end.

Role StringNotes: Read/WriteThe connector end role.

RoleNote String

(c) Sparx Systems 2018 Page 405 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteNotes associated with the role of thisconnector end.

RoleType StringNotes: Read/WriteThe role type applied to this end of theconnector.

Stereotype StringNotes: Read/WriteSets or gets the stereotype for thisconnector end.

StereotypeEx StringNotes: Read/WriteAll the applied stereotypes of theconnector end in a comma-separated list.Reading the value will provide thestereotype name only; assigning the valueaccepts either fully qualified or simplenames.

TaggedValues

Collection of type RoleTagNotes: Read onlyA collection of RoleTag objects.

(c) Sparx Systems 2018 Page 406 of 885

User Guide - Automation 26 July, 2018

Visibility StringNotes: Read/WriteThe Scope associated with this connectorend - Public, Private, Protected orPackage.

ConnectorEnd Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the current ConnectorEndobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 407 of 885

User Guide - Automation 26 July, 2018

ConnectorTag Class

A ConnectorTag is a Tagged Value for a connector and isaccessed through the Connector TaggedValues collection.

Associated table in .EAP file

t_connectortag

ConnectorTag Attributes

Attribute Remarks

ConnectorID LongNotes: Read/WriteThe local ID of the associated connector.

FQName StringNotes: Read onlyThe fully qualified name of the tag.

Name StringNotes: Read/WriteThe tag or name.

(c) Sparx Systems 2018 Page 408 of 885

User Guide - Automation 26 July, 2018

Notes StringNotes: Read/WriteFurther descriptive notes on this tag.If 'Value' is set to '<memo>', then 'Notes'should contain the actual Tagged Valuecontent.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

TagGUID StringNotes: Read/WriteA globally unique ID for this TaggedValue.

TagID LongNotes: Read onlyA local ID to identify the Tagged Value.

Value StringNotes: Read/WriteThe value assigned to this tag.This field has a 255 character limit. If thevalue is greater than 255 characters long,

(c) Sparx Systems 2018 Page 409 of 885

User Guide - Automation 26 July, 2018

set the value to "<memo>" and insert thebody of text in the 'Notes' attribute.When reading existing Tagged Values, if'Value' = "<memo>" then the developershould read the actual body of text fromthe 'Notes' attribute.

ConnectorTag Methods

Method Remarks

GetAttribute(stringpropName)

StringNotes: Returns the text of a single namedproperty within a Structured TaggedValue.

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

HasAttributes()

BooleanNotes: Returns True if the Tagged Valueis a Structured Tagged Value with one ormore properties.

(c) Sparx Systems 2018 Page 410 of 885

User Guide - Automation 26 July, 2018

SetAttribute(stringpropName,stringpropValue)

BooleanNotes: Sets the text of a single namedproperty within a Structured TaggedValue.

Update() BooleanNotes: Update the current ConnectorTagobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 411 of 885

User Guide - Automation 26 July, 2018

RoleTag Class

The RoleTag interface provides access to an Association'sRole Tagged Values. Each connector end has a RoleTagcollection that can be accessed to add, delete and access theRoleTags.

You might use this in creating code that resembles thisfragment for accessing a RoleTag in VB.NET (where con isa Connector Object):

client = con.ClientEnd

client.Role = "m_client"

client.Update()

tag = client.TaggedValues.AddNew("tag", "value")

tag.Update()

tag = client.TaggedValues.AddNew("tag2", "value2")

tag.Update()

client.TaggedValues.Refresh()

For idx = 0 To client.TaggedValues.Count - 1

tag = client.TaggedValues.GetAt(idx)

Console.WriteLine(tag.Tag)

client.TaggedValues.DeleteAt(idx, False)

Next

tag = Nothing

Associated table in .EAP file

(c) Sparx Systems 2018 Page 412 of 885

User Guide - Automation 26 July, 2018

t_taggedvalue

RoleTag Attributes

Attribute Description

BaseClass StringNotes: Read/WriteIndicates the role end; set toASSOCIATION_SOURCE orASSOCIATION_TARGET.

ElementGUID

StringNotes: Read/WriteThe GUID of the connector with whichthis role tag is associated.

FQName StringNotes: Read onlyThe fully qualified name of the tag.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

(c) Sparx Systems 2018 Page 413 of 885

User Guide - Automation 26 July, 2018

PropertyGUID

StringNotes: Read/WriteA system generated GUID to identify theTagged Value.

Tag StringNotes: Read/WriteThe actual tag name.

Value StringNotes: Read/WriteThe value associated with this tag.

RoleTag Methods

Method Description

GetAttribute(stringpropName)

StringNotes: Returns the text of a single namedproperty within a Structured TaggedValue.

GetLastError()

StringNotes: Returns a string value describing

(c) Sparx Systems 2018 Page 414 of 885

User Guide - Automation 26 July, 2018

the most recent error that occurred inrelation to this object.

HasAttributes()

BooleanNotes: Returns True if the Tagged Valueis a Structured Tagged Value with one ormore properties.

SetAttribute(stringpropName,stringpropValue)

BooleanNotes: Sets the text of a single namedproperty within a Structured TaggedValue.

Update() BooleanNotes: Update the RoleTag after changesor on initial creation.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 415 of 885

User Guide - Automation 26 July, 2018

TemplateBinding Class

A TemplateBinding defines the connector between abinding Class and a parameterized Class, and the bindingexpression on that connector.

TemplateBinding Attributes

Attribute Remarks

ActualGUID StringNotes: Read/WriteThe GUID of the element classifier set asthe Actual Template Binding parameter.If the Actual Template Binding parameteris set as a string expression only, this willbe an empty string.Assigning a GUID value willautomatically change the ActualNameattribute after Update() has been called.

ActualName StringNotes: Read/WriteThe name of the Actual TemplateBinding parameter.Assigning a new value will clear any

(c) Sparx Systems 2018 Page 416 of 885

User Guide - Automation 26 July, 2018

current ActualGUID value.

BindingExpression

StringNotes: Read onlyThe Binding Expression as shown inEnterprise Architect.

ConnectorGUID

StringNotes: Read onlyThe Globally Unique ID of the associatedconnector.

ConnectorType

StringNotes: Read onlyThe type of the associated connector.

FormalName StringNotes: Read/WriteThe name of the Formal TemplateBinding parameter.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch Interface.

Pos String

(c) Sparx Systems 2018 Page 417 of 885

User Guide - Automation 26 July, 2018

Notes: Read onlyThe position of the Template Binding inthe list (as on the 'Bindings' page of theconnector 'Properties' dialog).

TemplateBindingID

StringNotes: Read onlyThe Globally Unique ID of the currentTemplate Binding.

TemplateBinding Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

Update() BooleanNotes: Update the currentTemplateBinding object aftermodification or appending a new item.If False is returned, check the'GetLastError()' function for more

(c) Sparx Systems 2018 Page 418 of 885

User Guide - Automation 26 July, 2018

information.

(c) Sparx Systems 2018 Page 419 of 885

User Guide - Automation 26 July, 2018

Diagram Package

The Diagram Package has information on a diagram and onDiagramObject and DiagramLink, which are the instancesof elements within a diagram.

(c) Sparx Systems 2018 Page 420 of 885

User Guide - Automation 26 July, 2018

Diagram Class

A Diagram corresponds to a single UML diagram. It isaccessed through the Package Diagrams collection and inturn contains a collection of diagram objects and diagramconnectors. Adding to the DiagramObject Class adds anexisting element to the diagram. When adding a newdiagram, you must set the diagram type to one of the validtypes:

Activity·

Analysis·

Component·

Custom·

Deployment·

Logical·

Sequence·

Statechart·

Use Case·

For a Collaboration (Communication) diagram, use theAnalysis type.

Associated table in .EAP file

t_diagram

(c) Sparx Systems 2018 Page 421 of 885

User Guide - Automation 26 July, 2018

Diagram Attributes

Attribute Remarks

Author StringNotes: Read/WriteThe name of the author.

CreatedDate DateNotes: Read/WriteThe date the diagram was created.

cx LongNotes: Read/WriteThe X dimension of the diagram (thedefault is 800).

cy LongNotes: Read/WriteThe Y dimension of the diagram (thedefault is 1100).

DiagramGUID

VariantNotes: Read/WriteA globally unique ID for this diagram.

(c) Sparx Systems 2018 Page 422 of 885

User Guide - Automation 26 July, 2018

DiagramID LongNotes: Read onlyA local ID for the diagram.

DiagramLinks

CollectionNotes: Read onlyA list of DiagramLink objects, eachcontaining information about the displaycharacteristics of a connector in adiagram.

DiagramObjects

CollectionNotes: Read onlyA collection of references toDiagramObjects. A DiagramObject is aninstance of an element in a diagram, andincludes size and display characteristics.

ExtendedStyle

StringNotes: Read/WriteAn extended style attribute.

FilterElements

StringNotes: Read/WriteApplies a comma-separated list of objectids (from SelectedObjects) to thecurrently-applied diagram filter,overriding the filter. The effect persists

(c) Sparx Systems 2018 Page 423 of 885

User Guide - Automation 26 July, 2018

until another filter is applied, or thediagram is closed.

HighlightImports

BooleanNotes: Read/WriteA flag to indicate that elements fromother Packages should be highlighted. Corresponds with the 'Show Namespace'option in the diagram 'Properties' dialog.

IsLocked BooleanNotes: Read/WriteA flag indicating whether this diagram islocked or not.

MetaType StringNotes: Read/WriteThe diagram's domain-specific meta type,as defined by an MDG Technology.When writing, the meta type must befully qualified and from an existingprofile.

ModifiedDate

VariantNotes: Read/WriteThe date the diagram was last modified.

Name String

(c) Sparx Systems 2018 Page 424 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe diagram name.

Notes StringNotes: Read/WriteSet or retrieve notes for this diagram.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Orientation StringNotes: Read/WriteThe page orientation: P for Portrait or Lfor Landscape.

PackageID LongNotes: Read/WriteThe ID of the Package that this diagrambelongs to.

PageHeight LongNotes: ReadThe number of pages high the diagram is.

PageWidth Long

(c) Sparx Systems 2018 Page 425 of 885

User Guide - Automation 26 July, 2018

Notes: ReadThe number of pages wide the diagram is.

ParentID LongNotes: Read/WriteThe optional ID of an element that 'owns'this diagram; for example, a Sequencediagram owned by a Use Case.

Scale LongNotes: Read/WriteThe zoom scale (the default is 100).

SelectedConnector

ConnectorNotes: Read/WriteThe currently selected connector on thisdiagram. Null if there is no currentlyselected diagram.

SelectedObjects

CollectionNotes: Read onlyGets a collection representing thecurrently selected elements on thediagram.You can remove objects from thiscollection to deselect them, and addelements to the collection by passing the

(c) Sparx Systems 2018 Page 426 of 885

User Guide - Automation 26 July, 2018

Object ID as a name to select them.

ShowDetails LongNotes: Read/WriteA flag to indicate that the DiagramDetails text should be shown: 1 = Show,0 = Hide.

ShowPackageContents

BooleanNotes: Read/WriteA flag to indicate that the Packagecontents should be shown in the currentdiagram.

ShowPrivate BooleanNotes: Read/WriteA flag to show or hide Private features.

ShowProtected

BooleanNotes: Read/WriteA flag to show or hide Protected features.

ShowPublic BooleanNotes: Read/WriteA flag to show or hide Public features.

Stereotype String

(c) Sparx Systems 2018 Page 427 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteSets or gets the stereotype for thisdiagram.

StyleEx StringNotes: Read/WriteAdvanced style settings, reserved for theuse of Sparx Systems.

Swimlanes StringNotes: Read/WriteInformation on swimlanes contained inthe diagram.Please note that this property issuperseded by SwimlaneDef.

SwimlaneDef SwimlaneDefNotes: Read/WriteInformation on swimlanes contained inthe diagram.

Type StringNotes: Read onlyThe diagram type; see the t_diagramtypestable in the .eap file for more information.

Version String

(c) Sparx Systems 2018 Page 428 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe version of the diagram.

Diagram Methods

Method Details

ApplyGroupLock (stringaGroupName)

BooleanNotes: Applies a group lock to thisdiagram object, for the specified group,on behalf of the current user.Returns True if the operation issuccessful; returns False if the operationis unsuccessful. Use GetLastError() toretrieve error information.Parameter:

aGroupName: String - the name of the·

user group for which to set the grouplock

ApplyUserLock ()

BooleanNotes: Applies a user lock to this diagramobject, for the current user.Returns True if the operation issuccessful; returns False if the operation

(c) Sparx Systems 2018 Page 429 of 885

User Guide - Automation 26 July, 2018

is unsuccessful. Use GetLastError() toretrieve error information.

FindElementInDiagram(longElementID)

BooleanNotes: This function activates theDiagram View and displays the diagramwith the diagram object selected. If thediagram is too large to display all of it onthe screen, the portion of the diagramcontaining the object is displayed withthe object shown in the center of thescreen. Diagram objects flagged asnon-selected are shown but are notselectedReturns True if the diagram object wasfound, the diagram displayed and theobject selected (or at least displayed) inthe view. Returns False if the diagramobject was not found in the diagram andthe diagram not displayed.Parameter

ElementID: Long - the element ID of·

the diagram object to locate

GetDiagramObjectByID(long ID,string DUID)

DiagramObjectNotes: Returns the DiagramObject object,if it exists on the diagram.Parameters:

(c) Sparx Systems 2018 Page 430 of 885

User Guide - Automation 26 July, 2018

ID: Long - the ElementID of the·

diagram objectDUID: String - the optional Diagram·

Unique ID of the diagram object

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

ReadStyle(stringStyleName)

StringNotes: Returns the current value of thenamed diagram style.Use GetLastError() to retrieve errorinformation.Parameters:

StyleName: String - the name of the·

diagram style whose value is to beretrieved; valid StyleNames are: - Show Element Property String - Show Connector Property String - Show Feature Property String

ReleaseUserLock ()

BooleanNotes: Releases a group lock or user lockon this diagram object.Returns True if the operation issuccessful; returns False if the operation

(c) Sparx Systems 2018 Page 431 of 885

User Guide - Automation 26 July, 2018

is unsuccessful. Use GetLastError() toretrieve error information.

ReorderMessages ()

VoidNotes: Resets the display order ofSequence and Collaboration messages.This is typically used after inserting ordeleting messages in the diagram.

SaveAsPDF(stringFileName)

BooleanNotes: Export the diagram to a PDFdocument. Returns True on success.Parameters:

FileName: String - full path to file·

location

SaveImagePage(long x,long y, longsizeX, longsizeY, stringfilename,long flags)

BooleanNotes: Saves a page of the diagram todisk.Returns True if the operation issuccessful; returns False if the operationis unsuccessful.Use GetLastError() to retrieve errorinformation.Parameters:

x: Long - the horizontal page·

y: Long - the vertical page·

(c) Sparx Systems 2018 Page 432 of 885

User Guide - Automation 26 July, 2018

sizeX: Long - currently unused; pass a·

value of 0 to ensure behavior does notchange in a future buildsizeY: Long - currently unused; pass a·

value of 0 to ensure behavior does notchange in a future buildfilename: String - the filename and path·

to save the imageflags: Long - additional options,·

currently unused; pass a value of 0 toensure behavior does not change in afuture build

The image type is determined by theextension of the filename. Currently only.emf, .bmp and .png formats aresupported.

ShowAsElementList (boolShowAsList,bool Persist)

BooleanNotes: Toggles the diagram displaybetween diagram format and DiagramList depending on the value ofShowAsList.If Persist is set, the display format iswritten to the database so the diagramalways opens in that format (diagram orlist). Otherwise, the display format fallsback to the default (diagram) once thedisplay is closed.

(c) Sparx Systems 2018 Page 433 of 885

User Guide - Automation 26 July, 2018

Parameters:ShowAsList: Boolean - indicates·

diagram or Diagram ListPersist: Boolean - indicates set·

(maintain ShowAsList value) or not(revert to default)

Update () BooleanNotes: Updates this diagram object aftermodification or appending a new item.If False is returned, use GetLastError() toretrieve error information.

VirtualizeConnector (intConnectorID,int Action,int X, int Y)

BooleanNotes: Creates a virtual copy of thesource or target element on a connector,and sets its location on the diagram as awaypoint on the connector. If the sourceelement is being virtualized, the waypointis created as the first on the connector,and if the target element is beingvirtualized, the waypoint is created as thelast on the connector.If called again on the same connector,removes the virtual element. However,the waypoint remains in place.As waypoints and therefore virtualelements can only be created on

(c) Sparx Systems 2018 Page 434 of 885

User Guide - Automation 26 July, 2018

connectors with the Custom line style, ifthe connector does not have this line stylethe method sets it. So, after this methodexecutes, an Update function should becalled for the connector as well as for thediagram. All parameters are required forthe function to complete successfully.Returns True if the operation issuccessful; returns False if the operationis unsuccessful.Parameters:

ConnectorID - Integer: the ID of the·

connector on which to create the virtualelementAction - Integer: the element to be·

virtualized; 1 for the source element, 2for the target elementX - Integer: the position on the X axis·

that the element's center point will bealigned withY - Integer: the position on the Y axis·

that the element's centre point will bealigned with

For example, to virtualize the sourceelement of the selected connector:function main(){

(c) Sparx Systems 2018 Page 435 of 885

User Guide - Automation 26 July, 2018

var diagram as EA.Diagram; var conn as EA.Connector; diagram =Repository.GetCurrentDiagram(); if(diagram != null) { var connector as EA.Connector. connector =diagram.SelectedConnector;

diagram.VirtualizeConnector(connector.ConnectorID, 1, 100, 150); connector.Update(); diagram.Update();

Repository.ReloadDiagram(diagram.DiagramID); } else { Session.Output("Script requires adiagram to be visible"); }}main();

WriteStyle Void

(c) Sparx Systems 2018 Page 436 of 885

User Guide - Automation 26 July, 2018

(stringStyleName,stringStyleValue)

Notes: Sets the value of the nameddiagram style.Use GetLastError() to retrieve errorinformation.Parameters:

StyleName: String - the name of the·

diagram style whose value is to beretrieved; valid StyleNames are: - Show Element Property String - Show Connector Property String - Show Feature Property StringStyleValue: String - the value to be set·

in the named diagram style; validvalues for the StyleNames listed aboveare 0 and 1

(c) Sparx Systems 2018 Page 437 of 885

User Guide - Automation 26 July, 2018

DiagramLinks Class

A DiagramLink is an object that holds display informationon a connector between two elements in a specific diagram.It includes, for example, the custom points and displayappearance. It can be accessed from the DiagramDiagramLinks collection.

Associated table in .EAP file

t_diagramlinks

DiagramLinks Attributes

Attribute Remarks

ConnectorID LongNotes: Read/WriteThe ID of the associated connector.

DiagramID LongNotes: Read/WriteThe local ID for the associated diagram.

Geometry String

(c) Sparx Systems 2018 Page 438 of 885

User Guide - Automation 26 July, 2018

Notes: Read/WriteThe geometry associated with the currentconnector in this diagram.

HiddenLabels

BooleanNotes: Indicates if this connector's labelsare hidden on the diagram.

InstanceID LongNotes: Read onlyThe connector identifier for the currentmodel.

IsHidden BooleanNotes: Read/WriteIndicates if this item is hidden or not.

LineColor LongNotes: Sets the line color of theconnector.Set to -1 to reset to the default color inthe model.

LineStyle LongNotes: Sets the line style of theconnector.1 = Direct

(c) Sparx Systems 2018 Page 439 of 885

User Guide - Automation 26 July, 2018

2 = Auto Routing3 = Custom Line4 = Tree Vertical5 = Tree Horizontal6 = Lateral Vertical7 = Lateral Horizontal8 = Orthogonal Square9 = Orthogonal Rounded

LineWidth LongNotes: Sets the line width of theconnector.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Path StringNotes: Read/WriteThe path of the connector in this diagram.

SourceInstanceUID

StringNotes: Read onlyReturns the Unique Identifier of thesource object.

(c) Sparx Systems 2018 Page 440 of 885

User Guide - Automation 26 July, 2018

SuppressSegment

BooleanNotes: Indicates whether the connectorsegments are suppressed.

Style StringNotes: Read/WriteAdditional style information; forexample, color or thickness.

TargetInstanceUID

StringNotes: Read onlyReturns the Unique Identifier of the targetobject.

DiagramLinks Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.This function is rarely used as anexception is thrown when an error occurs.

(c) Sparx Systems 2018 Page 441 of 885

User Guide - Automation 26 July, 2018

Update() BooleanNotes: Update the current DiagramLinkobject after modification or appending anew item.If False is returned, check the'GetLastError()' function for moreinformation.

(c) Sparx Systems 2018 Page 442 of 885

User Guide - Automation 26 July, 2018

DiagramObject Class

The DiagramObject Class stores presentation informationthat indicates what is displayed in a diagram and how it isshown.

Associated table in .EAP file

t_diagramobjects

DiagramObject Attributes

Attribute Remarks

BackgroundColor

LongNotes: The background color of theobject on the diagram.Set to -1 to re-set to the default color inthe model.

BorderColor LongNotes: The border line color of the objecton the diagram.Set to -1 to re-set to the default color inthe model.

(c) Sparx Systems 2018 Page 443 of 885

User Guide - Automation 26 July, 2018

BorderLineWidth

LongNotes: The border line width of the objecton the diagram.Valid values are 1 (narrowest) to 5(thickest); a default of 1 is applied if aninvalid value is passed in.

Bottom LongNotes: Read/WriteThe bottom edge position of the object onthe diagram. Enterprise Architect uses acartesian coordinate system, with {0,0}being the top-left corner of the diagram.For this reason, Y-axis values (Top andBottom) should always be negative.

DiagramID LongNotes: Read/WriteThe ID of the associated diagram.

ElementDisplayMode

LongNotes: Indicates how to adjust theelement features if the element is resized. 1 = Resize to longest feature 2 = Wrap features 3 = Truncate featuresDefaults to 1 if an invalid value is

(c) Sparx Systems 2018 Page 444 of 885

User Guide - Automation 26 July, 2018

supplied.

ElementID LongNotes: Read/WriteThe ElementID of the object instance inthis diagram.

FeatureStereotypesToHide

StringNotes: Lists the stereotypes to hide on theobject on the diagram.

FontBold BooleanNotes: Get or Set the status of the objecttext font as Bold.

FontColor LongNotes: The color of the font of the objecttext on the diagram.

FontItalic BooleanNotes: Get or Set the status of the objecttext font as Italic.

FontName StringNotes: The name of the font used for theobject text.

FontSize String

(c) Sparx Systems 2018 Page 445 of 885

User Guide - Automation 26 July, 2018

Notes: The size of the font used for theobject text.

FontUnderline

BooleanNotes: Get or Set the status of the objecttext font as Underlined.

InstanceGUID

StringNotes: The instance GUID for the objecton the diagram (the DUID).

InstanceID LongNotes: ReadHolds the connector identifier for thecurrent model.

IsSelectable BooleanNotes: Indicates whether this object onthe diagram can be selected.

Left LongNotes: Read/WriteThe left edge position of the object on thediagram.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced through

(c) Sparx Systems 2018 Page 446 of 885

User Guide - Automation 26 July, 2018

a Dispatch interface.

Right LongNotes: Read/WriteThe right edge position of the object onthe diagram.

Sequence LongNotes: Read/WriteThe sequence position when loading theobject into the diagram (this affects its Zorder).The Z-order is one-based and the lowestvalue is in the foreground.

ShowComposedDiagram

BooleanNotes: Indicates whether the object'scomposite diagram should be displayedby default when the object is selected.

ShowConstraints

BooleanNotes: Show constraints for this object onthe diagram.

ShowFormattedNotes

BooleanNotes: Show any formatting applied tothe notes, for this object on the diagram.ShowNotes must be True for the

(c) Sparx Systems 2018 Page 447 of 885

User Guide - Automation 26 July, 2018

formatted notes to be displayed.

ShowFullyQualifiedTags

BooleanNotes: Show fully qualified TaggedValues for this object on the diagram.

ShowInheritedAttributes

BooleanNotes: Show inherited attributes for thisobject on the diagram.

ShowInheritedConstraints

BooleanNotes: Show inherited constraints for thisobject on the diagram.

ShowInheritedOperations

BooleanNotes: Show inherited operations for thisobject on the diagram.

ShowInheritedResponsibilities

BooleanNotes: Show the inherited requirementswithin the Requirements compartment forthis object on the diagram.

ShowInheritedTags

BooleanNotes: Show inherited Tagged Values forthis object on the diagram.

ShowNotes Boolean

(c) Sparx Systems 2018 Page 448 of 885

User Guide - Automation 26 July, 2018

Note: Show the notes for this object onthe diagram.

ShowPackageAttributes

BooleanNotes: Show Package attributes for thisobject on the diagram.

ShowPackageOperations

BooleanNotes: Show Package operations for thisobject on the diagram.

ShowPortType

BooleanNotes: Show the Port type.

ShowPrivateAttributes

BooleanNotes: Show private attributes for thisobject on the diagram.

ShowPrivateOperations

BooleanNotes: Show private operations for thisobject on the diagram.

ShowProtectedAttributes

BooleanNotes: Show protected attributes for thisobject on the diagram.

ShowProtectedOperations

BooleanNotes: Show protected operations for this

(c) Sparx Systems 2018 Page 449 of 885

User Guide - Automation 26 July, 2018

object on the diagram.

ShowPublicAttributes

BooleanNotes: Show public attributes for thisobject on the diagram.

ShowPublicOperations

BooleanNotes: Show public operations for thisobject on the diagram.

ShowResponsibilities

BooleanNotes: Show the requirementscompartment for this object on thediagram.

ShowRunstates

BooleanNotes: Show Runstates for this object onthe diagram.

ShowStructuredCompartments

BooleanNote: Indicates whether to display theStructure Compartments for this object onthe diagram.

ShowTags BooleanNotes: Show Tagged Values for thisobject on the diagram.

(c) Sparx Systems 2018 Page 450 of 885

User Guide - Automation 26 July, 2018

Style VariantNotes: Read/WriteThe style information for this object.Returns a semi-colon delimited string thatdefines the current style settings.Changing a value will completelyoverwrite the previously existing value,so caution is advised to avoid losingexisting style information that you wantto keep.See Setting the Style.

TextAlign LongNotes: Indicates the alignment of text ona Text element on the diagram. 1 = Left aligned 2 = Center aligned 3 = Right alignedDefaults to 1 if an invalid value issupplied.

Top LongNotes: Read/WriteThe top edge position of the object on thediagram. Enterprise Architect uses acartesian coordinate system, with {0,0}being the top-left corner of the diagram.For this reason, Y-axis values (Top and

(c) Sparx Systems 2018 Page 451 of 885

User Guide - Automation 26 July, 2018

Bottom) should always be negative.

DiagramObject Methods

Method Remarks

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

ResetFont Notes: Resets the font of the object texton the diagram back to the model default.

SetFontStyle(FontName,FontSize,Bold, Italic,Underline)

BooleanNotes: Sets the font of the object text onthe diagram to the specified values.

SetStyleEx(stringParameter,string Value)

VoidNotes: Sets an individual parameter of theStyle string.Parameters:

Parameter: String - the name of the·

(c) Sparx Systems 2018 Page 452 of 885

User Guide - Automation 26 July, 2018

style parameter to modify; for example: "BCol" = background color "BFol" = font color "LCol" = line color "LWth" = line widthValue: String - the new value for the·

style parameter

Update() BooleanNotes: Updates the currentDiagramObject after modification orappending a new itemIf False is returned, check theGetLastError function for moreinformation.

Setting the Style

The Style attribute contains various settings that affect theappearance of a DiagramObject. However, it is notrecommended to directly edit this attribute string. Instead,use either the SetStyleEx method or one of the individualDiagramObject attributes such as BackgroundColor,FontColor or BorderColor.

For example, the Style string might contain a series ofvalues in a format such as:

(c) Sparx Systems 2018 Page 453 of 885

User Guide - Automation 26 July, 2018

BCol=n;BFol=n;LCol=n;LWth=n;

where:

BCol = Background Color·

BFol = Font Color·

LCol = Line Color·

LWth = Line Width·

The value assigned to each of the Style color properties is adecimal representation of the hex RGB value, whereRed=FF, Green=FF00 and Blue=FF0000.

This code snippet shows how you might change the stylesettings for all of the objects in the current diagram,changing the background color to red (FF=255) and the fontand line colors to yellow (FFFF=65535):

For Each aDiagObj In aDiag.DiagramObjects

aDiagObj.BackgroundColor=255

aDiagObj.FontColor=65535

aDiagObj.BorderColor=65535

aDiagObj.BorderLineWidth=1

aDiagObj.Update

aRepos.ReloadDiagram aDiagObj.DiagramID

Next

(c) Sparx Systems 2018 Page 454 of 885

User Guide - Automation 26 July, 2018

SwimlaneDef Class

A SwimlaneDef object makes available attributes relating toa single row or column in a list of swimlanes.

SwimlaneDef Attributes

Attribute Description

Bold BooleanNotes: Read/WriteShow the title text in bold.

FontColor LongNotes: Read/WriteThe RGB color used to draw the titles.

HideClassifier

BooleanNotes: Read/WriteRemoves any classifier from the titledisplay.

HideNames BooleanNotes: Read/WriteSet to True to hide the swimlane titles.

(c) Sparx Systems 2018 Page 455 of 885

User Guide - Automation 26 July, 2018

LineColor LongNotes: Read/WriteThe RGB color used to draw swimlaneborders.

LineWidth LongNotes: Read/WriteThe width, in pixels, of the line used todraw swimlanes. Valid values are 1, 2 or3.

Locked BooleanNotes: Read/WriteIf set to True, disables user modificationof the swimlanes via the diagram.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Orientation StringNotes: Read/WriteIndicates whether the swimlanes arevertical or horizontal.

ShowInTitle Boolean

(c) Sparx Systems 2018 Page 456 of 885

User Guide - Automation 26 July, 2018

Bar Notes: Read/WriteEnables vertical swimlane titles to beshown in the title bar.

Swimlanes SwimlanesNotes: Read/WriteA list of individual swimlanes.

(c) Sparx Systems 2018 Page 457 of 885

User Guide - Automation 26 July, 2018

Swimlanes Class

A Swimlanes object is attached to a diagram's SwimlaneDefobject and provides a mechanism to access individualswimlanes.

Swimlanes Attributes

Attribute Description

Count LongNotes: Read/WriteGives the number of swimlanes.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Swimlanes Methods

Method Description

(c) Sparx Systems 2018 Page 458 of 885

User Guide - Automation 26 July, 2018

Add(stringTitle, longWidth)

SwimlaneNotes: Adds a new swimlane to the endof the list, and returns a swimlane objectrepresenting the newly added entry.Parameters:

Title: String - The title text that appears·

at the top of the swimlane; this can bethe same as an existing swimlane titleWidth: Long - The width of the·

swimlane in pixels

Delete(objectIndex)

VoidNotes: Deletes a selected swimlane.If the string matches more than one entry,only the first entry is deleted.Parameter:

Index: Object - Either a string·

representing the title text or an integerrepresenting the zero-based index ofthe swimlane to delete

DeleteAll() VoidNotes: Removes all swimlanes.

Insert(longIndex, stringTitle, longWidth)

SwimlaneNotes: Inserts a swimlane at a specificposition, and returns a swimlane objectrepresenting the newly added entry.

(c) Sparx Systems 2018 Page 459 of 885

User Guide - Automation 26 July, 2018

Parameters:Index: Long - The zero-based index of·

the existing Swimlane before whichthis new entry is insertedTitle: String - The title text that appears·

at the top of the swimlane; this can bethe same as an existing swimlane titleWidth: Long - The width of the·

swimlane in pixels

Items(objectIndex)

Swimlane collectionNotes: Accesses an individual swimlane.If the string matches more than oneswimlane title, the first matchingswimlane is returned.Parameter:

Index: Object - Either a string·

representing the title text or an integerrepresenting the zero-based index ofthe swimlane to get

(c) Sparx Systems 2018 Page 460 of 885

User Guide - Automation 26 July, 2018

Swimlane Class

A Swimlane object makes available attributes relating to asingle row or column in a list of swimlanes.

Swimlane Attributes

Attribute Description

BackColor LongNotes: Read/WriteThe RGB color that the swimlane is filledwith.

ClassifiedGuid

StringNotes: Read/WriteThe GUID of the classifier Class. Thiscan be obtained from the correspondingelement object via the ElementGUIDproperty.

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

(c) Sparx Systems 2018 Page 461 of 885

User Guide - Automation 26 July, 2018

Title StringNotes: Read/WriteThe text at the head of the swimlane.

Width LongNotes: Read/WriteThe width of the swimlane, in pixels.

(c) Sparx Systems 2018 Page 462 of 885

User Guide - Automation 26 July, 2018

Project Interface Package

The Enterprise Architect.Project interface. This is theinterface to Enterprise Architect elements; it also includessome utility functions. You can get a pointer to this interfaceusing the Repository.GetProjectInterface method.

Example

(c) Sparx Systems 2018 Page 463 of 885

User Guide - Automation 26 July, 2018

Project Class

The Project interface can be accessed from the Repositoryusing GetProjectInterface(). The returned interface providesaccess to the XML-based Enterprise Architect AutomationInterface. Use this interface to get XML for the variousinternal elements and to run some utility functions toperform tasks such as load diagrams or run reports.

Project Attributes

Attribute Remarks

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Project Methods

Method Remarks

BuildExecutableStatemach

BooleanNotes: Builds Executable StateMachine

(c) Sparx Systems 2018 Page 464 of 885

User Guide - Automation 26 July, 2018

ine (stringElementGUID, stringExtraOptions)

code for an <<executable statemachine>>Artifact element.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element togenerateExtraOptions: String - enables extra·

options to be given to the command(currently unused)

CancelValidation ()

VoidNotes: Cancels a validation process.

CanValidate()

BooleanNotes: Returns a value to indicate that theModel Validation component is loaded.

ExportReferenceData(stringFileName,string Tables)

BooleanNotes: Exports Reference Data.Parameters:

FileName: String - the name of the file·

to output the reference data toTables: String - the list of reference·

data tables to be output; the data tabledelimeter is ";"If the string is empty, EnterpriseArchitect will prompt with a dialog toselect the tables to output

(c) Sparx Systems 2018 Page 465 of 885

User Guide - Automation 26 July, 2018

ImportReferenceData(stringFileName,stringDataSets)

BooleanNotes: Imports Reference DataParameters:

FileName: String - the name of the·

reference data file to import fromDataSets: String - the list of reference·

data sets to import from; the data setdelimeter is ";"If the string is empty, EnterpriseArchitect displays a dialog prompt toselect the data sets to import

GenerateBuildRunExecutableStateMachine (stringElementGUID, stringExtraOptions)

BooleanNotes: Generates, builds and runsExecutable StateMachine code for an<<executable statemachine>> Artifactelement, which will start simulation ofthe StateMachine.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element togenerateExtraOptions: String - enables extra·

options to be given to the command(currently unused)

CreateBaseli Boolean

(c) Sparx Systems 2018 Page 466 of 885

User Guide - Automation 26 July, 2018

ne (stringPackageGUID, stringVersion,string Notes)

Notes: Creates a Baseline of a specifiedPackage.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package toBaselineVersion: String - the version of the·

BaselineNotes: String - any notes concerning·

the Baseline

CreateBaselineEx (stringPackageGUID, stringVersion,string Notes,EA.CreateBaselineFlagFlags)

BooleanNotes: Creates a Baseline of a specifiedPackage, with a flag to exclude Packagecontents below the first level.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to beBaselinedVersion: String - the version of the·

BaselineNotes: String - any notes concerning·

the BaselineFlags: EA.CreateBaselineFlag -·

whether or not to exclude the Packagecontents below the first level

DefineRule String

(c) Sparx Systems 2018 Page 467 of 885

User Guide - Automation 26 July, 2018

(stringCategoryID,EA.EnumMVErrorTypeErrorType,stringErrorMessage)

Notes: Defines the individual rules thatcan be performed during modelvalidation. It must be called once for eachrule from the EA_OnInitializeUserRulesbroadcast handler.The return value is a RuleId, which canbe used for reference purposes when anindividual rule is executed by EnterpriseArchitect during model validation.See the Model Validation Example for adetailed example of the use of thismethod.Parameters:

CategoryId: String - should be passed·

the return value from theDefineRuleCategory methodErrorType: EA.EnumMVErrorType -·

depending on the severity of the errorbeing validated, can be: - mvErrorCritical - mvError - mvWarning, or - mvInformationErrorMessage: String - can contain a·

default error string, although this isprobably overridden by thePublishResult call

DefineRuleC

(c) Sparx Systems 2018 Page 468 of 885

User Guide - Automation 26 July, 2018

ategory(stringCategoryName)

StringNotes: Defines a category of rules thatcan be performed during model validation(there is typically one category perAdd-In). It must be called once from theEA_OnInitializeUserRules broadcasthandler.The return value is a CategoryId thatmust to be passed to the DefineRulemethod.See the Model Validation Example for adetailed example of the use of thismethod.Parameters:

CategoryName: String - a text string·

that is visible in the 'Model ValidationConfiguration' dialog

RunExecutableStatemachine (stringElementGUID, stringExtraOptions)

BooleanNotes: Runs Executable StateMachinecode for an <<executable statemachine>>Artifact element, which will startsimulation of the StateMachineParameters:

ElementGUID: String - the GUID (in·

XML format) of the element togenerateExtraOptions: String - enables extra·

(c) Sparx Systems 2018 Page 469 of 885

User Guide - Automation 26 July, 2018

options to be given to the command(currently unused)

DeleteBaseline (stringBaselineGUID)

BooleanNotes: Deletes a Baseline, identified bythe BaselineGUID, from the repository.Parameters:

BaselineGUID: String - the GUID (in·

XML format) of the Baseline to delete

DoBaselineCompare(stringPackageGUID, stringBaseline,stringConnectString)

StringNotes: Performs a Baseline comparisonusing the supplied Package GUID andBaseline GUID (obtained in the result listfrom GetBaselines).Optionally you can include theconnection string required to find theBaseline if it exists in a different modelfile.This method returns a log file of thestatus of all elements found andcompared in the difference procedure.You can use this log information as inputto DoBaselineMerge - automaticallymerging information from the Baseline.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to run the

(c) Sparx Systems 2018 Page 470 of 885

User Guide - Automation 26 July, 2018

comparison onBaseline: String - the GUID (in XML·

format) of the Baseline to run thecomparison onConnectString: String - the location of·

the external .eap file or DBMS toextract the Baseline from

DoBaselineMerge (stringPackageGUID, stringBaseline,stringMergeInstructions, stringConnectString)

StringNotes: Performs a batch merge based oninstructions contained in an XML file(MergeInstructions). You can supply anoptional connection string if the Baselineis located in another model.In the MergeInstructions file, eachMergeItem node supplies the GUID of adifferenced item from the XMLdifference log. As the merge isuni-directional and actioned in only onepossible way, no additional arguments arerequired. Enterprise Architect chooses thecorrect procedure based on the'Difference' results. <Merge> <MergeItem guid="{XXXXXX}" /> <MergeItem guid="{XXXXXX}" /> </Merge>Alternatively, you can supply a single

(c) Sparx Systems 2018 Page 471 of 885

User Guide - Automation 26 July, 2018

Mergeitem with a GUID of RestoreAll.In this case, Enterprise Architectbatch-processes ALL differences. <Merge> <MergeItem guid="RestoreAll"changed="true" baselineOnly="true"modelOnly="true" moved="true"fullRestore="false" /> </Merge>Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to mergethe Baseline intoBaseline: String - the GUID of the·

Baseline (in XML format) to mergeinto the PackageMergeInstructions: String - the file·

containing the GUID of eachdifferenced item from the XMLdifference log returned byDoBaselineCompare()ConnectString: String - the location of·

the EAP file or DBMS to get theBaseline from, if not in the same modelas the Package

EnumDiagramElements

protected abstract: StringNotes: Gets an XML list of all elements

(c) Sparx Systems 2018 Page 472 of 885

User Guide - Automation 26 July, 2018

(stringDiagramGUID)

in a diagram.Parameters:

DiagramGUID: String - the GUID (in·

XML format) of the diagram to getelements for

EnumDiagrams (stringPackageGUID)

protected abstract: StringNotes: Gets an XML list of all diagramsin a specified Package.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to listdiagrams for

EnumElements (stringPackageGUID)

protected abstract: StringNotes: Gets an XML list of elements in aspecified Package.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to get alist of elements for

EnumLinks(stringElementGUID)

protected abstract: StringNotes: Gets an XML list of connectorsfor a specified element.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element to get all

(c) Sparx Systems 2018 Page 473 of 885

User Guide - Automation 26 July, 2018

associated connectors for

EnumPackages (stringPackageGUID)

protected abstract: StringNotes: Gets an XML list of childPackages inside a parent Package.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the parent Package

EnumProjects ()

protected abstract: StringNotes: Gets a list of projects in thecurrent file; corresponds to Models inRepository.

EnumViews()

protected abstract: StringNotes: Enumerates the Views for aproject. Returned as an XML document.

EnumViewEx (stringProjectGUID)

protected abstract: StringNotes: Gets a list of Views in the currentproject.Parameters:

ProjectGUID: String - the GUID (in·

XML format) of the project to getviews for

Exit () protected abstract: StringNotes: Exits the current instance of

(c) Sparx Systems 2018 Page 474 of 885

User Guide - Automation 26 July, 2018

Enterprise Architect; this function ismaintained for backward compatibilityand should never be called.Enterprise Architect automatically exitswhen you are no longer using any of theprovided objects.

ExportPackageXMI(stringPackageGUID,enumXMIType XMIType,longDiagramXML, longDiagramImage, longFormatXML,longUseDTD,stringFileName)

protected abstract: StringNotes: Exports XMI for a specifiedPackage.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to beexportedXMIType: EnumXMIType - specifies·

the XMI type and version information;see XMIType Enum for accepted valuesDiagramXML: Long - True if XML for·

diagrams is required; accepted values: 0 = Do not export diagrams 1 = Export diagrams 2 = Export diagrams along withalternate imagesDiagramImage: Long - the format for·

diagram images to be created at thesame time; accepted values: -1 = NONE 0 = EMF

(c) Sparx Systems 2018 Page 475 of 885

User Guide - Automation 26 July, 2018

1 = BMP 2 = GIF 3 = PNG 4 = JPGFormatXML: Long - True if XML·

output should be formatted prior tosavingUseDTD: Long - True if a DTD should·

be usedFileName: String - the filename to·

output to

ExportPackageXMIEx(stringPackageGUID,enumXMIType XMIType,longDiagramXML, longDiagramImage,longFormatXML,longUseDTD,string

protected abstract: StringNotes: Exports XMI for a specifiedPackage, with a flag to determinewhether the export includes Packagecontent below the first level.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to beexportedXMIType: EnumXMIType - specifies·

the XMI type and version information;see XMIType Enum for accepted valuesDiagramXML: Long - true if XML for·

diagrams is required; accepted values: 0 = Do not export diagrams 1 = Export diagrams

(c) Sparx Systems 2018 Page 476 of 885

User Guide - Automation 26 July, 2018

FileName,ea.ExportPackageXMIFlag Flags)

2 = Export diagrams along withalternate imagesDiagramImage: Long - the format for·

diagram images to be created at thesame time; accepted values: -1 =NONE 0 =EMF 1 =BMP 2 =GIF 3 =PNG 4 =JPGFormatXML: Long - True if XML·

output should be formatted prior tosavingUseDTD: Long - True if a DTD should·

be used.FileName: String - the filename to·

output toFlags: ea.ExportPackageXMIFlag -·

specify whether or not to includePackage content below the first level(currently supported forxmiEADefault), whether or not toexclude tool-specific information fromexport

GenerateClass (stringElementGUI

BooleanNotes: Generates the code for a single

(c) Sparx Systems 2018 Page 477 of 885

User Guide - Automation 26 July, 2018

D, stringExtraOptions)

Class.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element togenerateExtraOptions: String - enables extra·

options to be given to the command;currently unused

GenerateDiagramFromScenario (stringElementGUID,EnumScenarioDiagramTypeDiagramType, longOverwriteExistingDiagram)

BooleanNotes: Generates various diagrams fromthe Structured Specification of anelement.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element containingthe Structured SpecificationDiagramType:·

EnumScenarioDiagramType - the typeof diagram to generate; seeScenarioDiagramType Enum foraccepted valuesOverwriteExistingDiagram: Long -·

determines whether to overwrite theexisting diagram or synchronize theexisting elements with the scenariosteps 0 = Delete the existing diagram and

(c) Sparx Systems 2018 Page 478 of 885

User Guide - Automation 26 July, 2018

elements, and create a new diagramand elements 1 = Synchronize existing elementswith the scenario steps and preserve thediagram layout 2 = Synchronize existing elementswith the scenario steps and re-cast thediagram layout 3 = Do not generate a diagram if onealready exists

GenerateElementDDL(stringElementGUID, stringFileName,stringExtraOptions)

BooleanNotes: Generates DDL for an elementusing the options that are currently set onthe Generate DDL screen.

GenerateExecutableStatemachine(stringElementGUID, stringExtraOptions)

BooleanNotes: Generates ExecutableStateMachine code for an <<executablestatemachine>> Artifact element.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element togenerate

(c) Sparx Systems 2018 Page 479 of 885

User Guide - Automation 26 July, 2018

ExtraOptions: String - enables extra·

options to be given to the command(currently unused)

GeneratePackage (stringPackageGUID,stringExtraOptions)

BooleanNotes: Generates the code for all Classeswithin a Package.For example: recurse=1;overwrite=1;dir=C:\Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package togenerate code forExtraOptions: String - enables extra·

options to be given to the command;currently enables: - Generation of all sub-Packages(recurse) - Force overwrite of all files(overwrite) and - Specification to auto generate allpaths (dir)

GeneratePackageDDL(stringPackageGUID, stringFileName,

BooleanNotes: Generates DDL for all elements ina Package using the options that arecurrently set on the Generate DDLscreen.

(c) Sparx Systems 2018 Page 480 of 885

User Guide - Automation 26 July, 2018

stringExtraOptions)

GenerateTestFromScenario (stringElementGUID,EnumScenarioTestTypeTestType)

BooleanNotes: Generates a Vertical Test Suite, aHorizontal Test Suite, an Internal test oran External test from the StructuredSpecification of an element.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element containingthe Structured SpecificationTestType: EnumScenarioTestType -·

the type of test to generate; seeScenarioTestType Enum for acceptedvalues

GenerateWSDL(stringWSDLComponentGUID,stringFilename,stringEncoding,stringExtraOptions)

BooleanNotes: Generates WSDL for the specifiedWSDL stereotyped Component.Parameters:

WSDLComponentGUID: String - the·

GUID (in XML format) of the WSDLstereotyped ComponentFilename: String - the target file path·

Encoding: String - the XML encoding·

for the code page instruction

(c) Sparx Systems 2018 Page 481 of 885

User Guide - Automation 26 July, 2018

ExtraOptions: String - enables extra·

options to be given to the command;currently unused

GenerateXSD (stringPackageGUID,stringFileName,stringEncoding,stringOptions)

BooleanNotes: Creates an XML schema for aPackage, specified by its GUID. ReturnsTrue on success.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the PackageFileName: String - the target filepath·

Encoding: String - the XML encoding·

for the code page instructionOptions: String - enables extra options·

to be given to the command, in acomma-separated string; currentlyenables: - GenGlobalElement - turn thegeneration of global elements for all global ComplexTypes On orOff; for example: GenGlobalElement=1 - UseRelativePath - turns on or offthe option to use a relative path in the XSD import or XSDinclude statement when referencing external Package,provided the schemaLocation tag

(c) Sparx Systems 2018 Page 482 of 885

User Guide - Automation 26 July, 2018

is empty on the referencedPackages; for example: UseRelativePath=1

GetBaselines(stringPackageGUID, stringConnectString)

StringNotes: Returns a list (in XML format) ofBaselines associated with the suppliedPackage GUID. Optionally, you canprovide a connection string to getBaselines from the same Package, butlocated in a different model file (orDBMS).Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to getBaselines forConnectString: String - the location of·

the EAP file or DBMS to get theBaselines from, if not in the samemodel as the Package

GetDiagram(stringDiagramGUID)

protected abstract: StringNotes: Gets the diagram details, in XMLformat.Parameters:

DiagramGUID: String - the GUID (in·

XML format) of the diagram to getdetails for

(c) Sparx Systems 2018 Page 483 of 885

User Guide - Automation 26 July, 2018

GetElement(stringElementGUID)

protected abstract: StringNotes: Gets XML for the specifiedelement.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element to retrieveXML for

GetElementConstraints(stringElementGUID)

protected abstract: StringNotes: Gets constraints for an element, inXML format.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element

GetElementEffort (stringElementGUID)

protected abstract: StringNotes: Gets efforts for an element, inXML format.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element

GetElementFiles (stringElementGUID)

protected abstract: StringNotes: Gets metrics for an element, inXML format.Parameters:

(c) Sparx Systems 2018 Page 484 of 885

User Guide - Automation 26 July, 2018

ElementGUID: String - the GUID (in·

XML format) of the element

GetElementMetrics(stringElementGUID)

protected abstract: StringNotes: Gets files for an element, in XMLformat.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element

GetElementProblems(stringElementGUID)

protected abstract: StringNotes: Gets a list of issues (problems)associated with an element, in XMLformat.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element

GetElementProperties(stringElementGUID)

protected abstract: StringNotes: Gets Tagged Values for anelement, in XML format.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element

GetElementRequirements(string

protected abstract: StringNotes: Gets a list of requirements for an

(c) Sparx Systems 2018 Page 485 of 885

User Guide - Automation 26 July, 2018

ElementGUID)

element, in XML format.Parameters:

ElementGUID: String -the GUID (in·

XML format) of the element

GetElementResources(stringElementGUID)

protected abstract: StringNotes: Gets a list of resources for anelement, in XML format.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element

GetElementRisks (stringElementGUID)

protected abstract: StringNotes: Gets a list of risks associated withan element, in XML format.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element

GetElementScenarios(stringElementGUID)

protected abstract: StringNotes: Gets a list of scenarios for anelement, in XML format.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element

GetElementT protected abstract: String

(c) Sparx Systems 2018 Page 486 of 885

User Guide - Automation 26 July, 2018

ests (stringElementGUID)

Notes: Gets a list of tests for an element,in XML format.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element

GetFileNameDialog(stringFilename,stringFilterString,longFilterIndex,long Flags,stringInitialDirectory,longOpenOrSave)

StringNotes: Opens a standard 'File Open' or'Save As' dialog and returns a stringcontaining the full path to the selectedfile on success. Returns an empty string ifthe dialog was canceled.For example: Filename = "" FilterString = "CSV Files(*.csv)|*.csv|All Files (*.*)|*.*||" Filterindex = 1 Flags = &H2'OFN_OVERWRITEPROMPT InitialDirectory = "" OpenOrSave = 1 filepath = Project.GetFileNameDialog(Filename, FilterString, Filterindex,Flags, InitialDirectory, OpenOrSave)In this example, the 'Save As' dialog willprompt for a CSV file.Parameters:

(c) Sparx Systems 2018 Page 487 of 885

User Guide - Automation 26 July, 2018

Filename: String - default filename·

specified in the dialogFilterString: String - delimited list of·

available file type filtersFilterindex: Long - one-based index of·

the filter to be used by defaultFlags: Long - additional bit flags used·

to initialize the file dialog; see theOPENFILENAME structure in MSDNdocumentation for accepted valuesInitialDirectory: String - directory path·

to open this dialogOpenOrSave: Long - show dialog as an·

'Open' or 'Save As' style dialog;accepted values: 0 = Open, 1 = Save As

GetLastError()

protected abstract: StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

GetLink(stringLinkGUID)

protected abstract: StringNotes: Gets connector details, in XMLformat.Parameters:

LinkGUID: String - the GUID (in·

XML format) of the connector to getdetails of

(c) Sparx Systems 2018 Page 488 of 885

User Guide - Automation 26 July, 2018

GUIDtoXML(stringGUID)

StringNotes: Changes an internal GUID to theform used in XML.Parameters:

GUID: String - the Enterprise Architect·

style GUID to convert to XML format

ImportDirectory (stringPackageGUID, stringLanguage,stringDirectoryPath, stringExtraOptions)

BooleanNotes: Imports a source code directoryinto the model.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to reverseengineer code intoLanguage: String - specifies the·

language of the code to be importedDirectoryPath: String - specifies the·

path where the code is found on thecomputerExtraOptions: String - enables extra·

options to be given to the command;currently enables import of source fromall child directories (recurse) - forexample: recurse=1

ImportFile(string

BooleanNotes: Imports an individual file or

(c) Sparx Systems 2018 Page 489 of 885

User Guide - Automation 26 July, 2018

PackageGUID, stringLanguage,stringFileName,stringExtraOptions)

binary module into the model, in aPackage per namespace style import.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to reverseengineer code into; this is expected tobe a namespace root PackageLanguage: String - specifies the·

language of the code to be importedUse the value 'DNPE' to import abinary module; this imports a .NETassembly or Java .class file, but not a.jar fileFilename: String - specifies the path·

where the code or module is found onthe computerExtraOptions: String - enables extra·

options to be given to the command;currently unused

ImportPackageXMI(stringPackageGUID, stringFilename,longImportDiagrams, long

StringNotes: Imports an XMI file at a point inthe tree. Returns an empty string ifsuccessful, or returns an error message onfailure.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the target Package to

(c) Sparx Systems 2018 Page 490 of 885

User Guide - Automation 26 July, 2018

StripGUID) import the XMI file into (or overwritewith the XMI file)Filename or XMLText: String - the·

name of the XMI file; if the String is oftype filename it is interpreted as asource file, otherwise the String isimported as XML textImportDiagrams: Long - 1 for·

importing diagrams and 0 to skipimporting diagramsStripGUID: Long·

- 1 to replace the element UniqueIDson import; if stripped, then a copy of the Package could beimported into the same Enterprise Architect model as two differentversions - 0 to retain the element UniqueIDson import; a duplicate copy of the Package cannot be created inthe same model of Enterprise Architect

LayoutDiagram (stringDiagramGUID, longLayoutStyle)

BooleanNotes: Deprecated. it is recommendedthat LayoutDiagramEx is used instead.Calls the function to automatically layouta diagram in hierarchical fashion. It isonly recommended for Class and Object

(c) Sparx Systems 2018 Page 491 of 885

User Guide - Automation 26 July, 2018

diagrams.Parameters:

DiagramGUID: String - the GUID (in·

XML format) of the diagram to lay outLayoutStyle: Long - always ignored·

LayoutDiagramEx (stringDiagramGUID, longLayoutStyle,longIterations,longLayerSpacing, longColumnSpacing, booleanSaveToDiagram)

BooleanNotes: Calls the function to automaticallylayout a diagram in hierarchical fashion.It is only recommended for Class andObject diagrams.LayoutStyle accepts these options

Default Options:·

- lsDiagramDefault - lsProgramDefault

Cycle Removal Options:·

- lsCycleRemoveGreedy - lsCycleRemoveDFS

Layering Options:·

- lsLayeringLongestPathSink - lsLayeringLongestPathSource - lsLayeringOptimalLinkLength

Initialize Options:·

- IsInitializeNaive - IsInitializeDFSOut - IsInitializeDFSIn

(c) Sparx Systems 2018 Page 492 of 885

User Guide - Automation 26 July, 2018

Crossing Reduction Option:·

- lsCrossReduceAggressiveLayout Options - Direction·

- lsLayoutDirectionUp - lsLayoutDirectionDown - lsLayoutDirectionLeft - lsLayoutDirectionRightParameters:

DiagramGUID: String - the GUID (in·

XML format) of the diagram to lay outLayoutStyle: Long - the layout style·

Iterations: Long - the number of layout·

iterations the Layout process shouldtake to perform cross reduction(Default value = 4)LayerSpacing: Long - the per-element·

layer spacing the Layout processshould use (Default value = 20)ColumnSpacing: Long - the·

per-element column spacing the Layoutprocess should use (Default value = 20)SaveToDiagram: Boolean - specifies·

whether or not Enterprise Architectshould save the supplied layout optionsas default to the diagram in question

LoadControll String

(c) Sparx Systems 2018 Page 493 of 885

User Guide - Automation 26 July, 2018

edPackage(stringPackageGUID)

Notes: Loads a Package that has beenmarked and configured as controlled. Thefilename details are stored in the Packagecontrol data.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Package to load

LoadDiagram(stringDiagramGUID)

protected abstract: BooleanNotes: Loads a diagram by its GUID.Parameter:

DiagramGUID: String - the GUID (in·

XML format) of the diagram to load; ifyou retrieve the GUID using theDiagram interface, use theGUIDtoXML function to convert it toXML format

LoadProject(stringFileName)

protected abstract: BooleanNotes: Loads an Enterprise Architectproject file.Do not use this method if you haveaccessed the Project interface from theRepository, which has already loaded afile.Parameters:

FileName: String - the name of the·

project file to load

(c) Sparx Systems 2018 Page 494 of 885

User Guide - Automation 26 July, 2018

Migrate(stringGUID, stringSourceType,stringDestinationType)

VoidNotes: Migrates a model (or part of amodel) from one BPMN, ArchiMate,UPDM or SysML format to an upgradedformat.Parameters:

GUID: String - the GUID of the·

Package or element for which thecontents are to be migratedSourceType: String - the type of model·

to be upgraded; accepted values: - BPMN - BPMN1.1 - UPDM - SysML1.1 - SysML1.2 - SysML1.3 - ArchiMate - ArchiMate2 - UPDM2DestinationType: String - the type of·

model to upgrade to; accepted values: - BPMN1.1 - BPMN1.1::BPEL - BPMN2.0 - UPDM2 - SysML1.2 - SysML1.3

(c) Sparx Systems 2018 Page 495 of 885

User Guide - Automation 26 July, 2018

- SysML1.4 - ArchiMate2 - ArchiMate3 - UAF

MigrateToBPMN11 (stringGUID,string Type)

VoidNotes: Migrates every BPMN 1.0construct in a Package or an element(including elements, attributes, diagramsand connectors) to BPMN 1.1.Parameters

GUID: String - the GUID of the·

Package or element for which thecontents are to be migrated to BPMN1.1Type: String - the type of upgrade,·

either just to BPMN 1.1 or to BPMN1.1 and BPEL. Accepted values are:- BPMN = migrate to BPMN 1.1- BPEL = migrate to BPMN 1.1 andupdate: - any diagram with stereotypeBPMN to BPEL - any element with stereotypeBusinessProcess to BPELProcess

Migrating to BPEL is possible in theUltimate or Unified editions of EnterpriseArchitect.

(c) Sparx Systems 2018 Page 496 of 885

User Guide - Automation 26 July, 2018

ProjectTransfer (stringSourceFilePath,stringTargetFilePath,stringLogFilePath)

BooleanNotes: Transfers the project from a .eapfile or DBMS to a .eap file.Parameters:

SourceFilePath: String - the path of the·

source file to transferTargetFilePath: String - the path of the·

target file; Enterprise Architect createsa new Base project in this locationLogFilePath: String - the path of the·

log file where the status of the transferprocess is updated

In automation, the target file does nothave to exist; the file path is enough.Enterprise Architect creates a new, emptyBase.eap file and transfers the sourceproject into it.

PublishResult(stringCategoryID,EA.EnumMVErrorTypeErrorType,stringErrorMessage)

StringNotes: Returns the results of each rulethat can be performed during modelvalidation. It must be called once for eachrule from the EA_OnInitializeUserRulesbroadcast handler.The return value is a RuleId, which canbe used for reference purposes when anindividual rule is executed by EnterpriseArchitect during model validation.

(c) Sparx Systems 2018 Page 497 of 885

User Guide - Automation 26 July, 2018

See the Model Validation Example for adetailed example of the use of thismethod.Parameters:

CategoryId: String - should be passed·

the return value from theDefineRuleCategory methodErrorType: EA.EnumMVErrorType -·

depending on the severity of the errorbeing validated, can be: - mvErrorCritical - mvError - mvWarning, or - mvInformationErrorMessage: String - contains an·

error string

PutDiagramImageOnClipboard (stringDiagramGUID,long Type)

protected abstract: BooleanNotes: Copies an image of the specifieddiagram to the clipboard.Parameters:

DiagramGUID: String - the GUID (in·

XML format) of the diagram to copyType: Long - the file type·

- If Type = 0 then it is a metafile - If Type = 1 then it is a DeviceIndependent Bitmap

(c) Sparx Systems 2018 Page 498 of 885

User Guide - Automation 26 July, 2018

PutDiagramImageToFile(stringDiagramGUID,stringFileName,long Type)

protected abstract: BooleanNotes: Saves an image of the specifieddiagram to file.Parameters:

DiagramGUID: String - the GUID (in·

XML format) of the diagram to saveFileName: String - the name of the file·

to save the diagram intoType: Long - the file type·

- If type = 0 then it is a metafile - If type = 1 then it uses the file typefrom the name extension (that is, .bmp, .jpg, .gif, .png, .tga)

ReloadProject ()

protected abstract: BooleanNotes: Reloads the current project.This is a convenient method to refresh thecurrent loaded project (in case of outsidechanges to the .eap file).

RunModelSearch (stringSearch, stringSearchTerm,boolShowInEA)

VoidNotes: Invokes the Model Searchcomponent.Parameters:

Search: String - the name of an·

Enterprise Architect defined searchSearchTerm: String - the term to search·

(c) Sparx Systems 2018 Page 499 of 885

User Guide - Automation 26 July, 2018

for in the projectShowInEA: Boolean - execute the·

search and output in the Model Searchwindow

RunReport(stringPackageGUID,stringTemplateName,stringFilename)

protected abstract: VoidNotes: Runs a named document report.Parameters:

PackageGUID: String - the GUID of·

the Package or master document to runthe report onTemplateName: String - the document·

report template to use; if thePackageGUID has a stereotype ofMasterDocument, the template is notrequiredFileName: String - the file name and·

path to store the generated report; thefile extension specified will determinethe format of the generated document -for example, RTF, PDF

RunHTMLReport (stringPackageGUID,stringExportPath,

StringNotes: Runs an HTML report (as for'Documentation | Publish as HTML' whenyou click on a Package in the ProjectBrowser and on the icon).Parameters:

(c) Sparx Systems 2018 Page 500 of 885

User Guide - Automation 26 July, 2018

stringImageFormat,string Style,stringExtension)

PackageGUID: String - the GUID (in·

XML format) of the Package or masterdocument to run the report onExportPath: String - the directory path·

to store the generated report filesImageFormat: String - file format in·

which to store images - .png or .gifStyle: String - name of the web style·

template to apply; use <default> for thestandard, system-provided templateExtension: String - file extension for·

generated HTML files (example: .htm)

SaveControlledPackage(stringPackageGUID)

StringNotes: Saves a Package that has beenconfigured as a controlled Package, toXMI. Only the Package GUID isrequired, Enterprise Architect picks therest up from the Package controlinformation.Parameter:

PackageGUID: String - the GUID (in·

XML format) of the Package to save

SaveDiagramImageToFile(stringFilename)

protected abstract: StringNotes: Saves a diagram image of thecurrent diagram to file.Parameters:

(c) Sparx Systems 2018 Page 501 of 885

User Guide - Automation 26 July, 2018

FileName: String - the filename of the·

image to save

ShowWindow (longShow)

protected abstract: VoidNotes: Shows or hides the EnterpriseArchitect User Interface.Parameters:

Show: Long·

SynchronizeClass (stringElementGUID,stringExtraOptions)

BooleanNotes: Synchronizes a Class with thelatest source code.Parameters:

ElementGUID: String - the GUID (in·

XML format) of the element to updatefrom codeExtraOptions: String - enables extra·

options to be given to the command;currently unused

SynchronizePackage(stringPackageGUID,stringExtraOptions)

BooleanNotes: Synchronizes each Class in aPackage with the latest source code.Parameters:

PackageGUID: String - the GUID (in·

XML format) of the Packagecontaining the elements to update fromcode

(c) Sparx Systems 2018 Page 502 of 885

User Guide - Automation 26 July, 2018

ExtraOptions: String - enables extra·

options to be given to the command;currently enables synchronization of allchild Packages (children) - forexample: children=1

TransformElement (stringTransformName,stringElementGUID,stringTargetPackage,stringExtraOptions)

BooleanNotes: Transforms an element into aPackage.Parameters:

TransformName: String - specifies the·

transformation that should be executedElementGUID: String - the GUID (in·

XML format) of the element totransformTargetPackageGUID: String - the·

GUID (in XML format) of the Packageto transform intoExtraOptions: String - enables extra·

options to be given to the command: - GenCode=True / False - articulatecode generation from the transformed elements; this optionsupercedes the current model setting

TransformPackage (stringTransformNa

BooleanNotes: Runs a transformation on the

(c) Sparx Systems 2018 Page 503 of 885

User Guide - Automation 26 July, 2018

me,stringSourcePackage,stringTargetPackage,stringExtraOptions)

contents of a Package.Parameters:

TransformName: String - specifies the·

transformation that should be executedSourcePackageGUID: String - the·

GUID (in XML format) of the Packageto transformTargetPackageGUID: String - the·

GUID (in XML format) of the Packageto transform intoExtraOptions: String - enables extra·

options to be given to the command: - GenCode=True/False - articulatecode generation from the transformedelements; this option supercedes the currentmodel setting - SubPackages=True/False - specifyif the child Packages are to be includedwhilst transforming a Package

ValidateDiagram (stringDiagramGUID)

BooleanNotes: Invokes the Enterprise ArchitectModel Validation component, thenvalidates the diagram (for correctness)and the elements and connectors withinthe diagram.

(c) Sparx Systems 2018 Page 504 of 885

User Guide - Automation 26 July, 2018

Output can be viewed through 'Start >Explore > Browse > System Output >Model Validation'.Returns a boolean value to indicate thesuccess or failure of the process,regardless of the results of the validation.Parameters:

DiagramGUID: String - the GUID of·

the Diagram Class object

ValidateElement (stringElementGUID)

BooleanNotes: Invokes the Enterprise ArchitectModel Validation component, thenvalidates the element and all childelements, diagrams, connectors, attributesand operations.Output can be viewed through 'Start >Explore > Browse > System Output >Model Validation'.Returns a boolean value to indicate thesuccess or failure of the process,regardless of the results of the validation.Parameters:

ElementGUID: String - the GUID of·

the Element Class object

ValidatePackage (string

BooleanNotes: Invokes the Enterprise Architect

(c) Sparx Systems 2018 Page 505 of 885

User Guide - Automation 26 July, 2018

PackageGUID)

Model Validation component, thenvalidates the Package and allsub-Packages, elements, connectors anddiagrams within it.Output can be viewed through 'Start >Explore > Browse > System Output >Model Validation'.Returns a boolean value to indicate thesuccess or failure of the process,regardless of the results of the validation.Parameters:

PackageGUID: String - the GUID of·

the Package Class object

XMLtoGUID(stringGUID)

StringNotes: Changes a GUID in XML formatto the form used inside EnterpriseArchitect.Parameters:

GUID: String - the XML style GUID to·

convert to Enterprise Architect internalformat

Notes

(c) Sparx Systems 2018 Page 506 of 885

User Guide - Automation 26 July, 2018

These methods all require input GUIDs in XML format;·

use GUIDtoXML to change the Enterprise ArchitectGUID to an XML GUID

(c) Sparx Systems 2018 Page 507 of 885

User Guide - Automation 26 July, 2018

Document Generator InterfacePackage

The DocumentGenerator Class provides an interface to thedocument and web reporting facilities, which you can use togenerate reports on specific Packages, diagrams andelements in your model.

Access

You can create a pointer to this interface using theRepository.CreateDocumentGenerator method.

Example

This diagram illustrates how you might use the DocumentGenerator interface in generating a report through theAutomation Interface.

(c) Sparx Systems 2018 Page 508 of 885

User Guide - Automation 26 July, 2018

loop

Automation Client Repository DocumentGenerator

1.2 DocumentElement()

1.3 SaveDocument()

1.0 CreateDocumentGenerator()

1.1 NewDocument()

Also look at the:

Document Generation scripting example in the Scripting·

window ('Specialize > Tools > Scripting', then expand the'Local Scripts' folder and double-click on 'JScript -Documentation Example')

RunReport method in the Project Interface·

(c) Sparx Systems 2018 Page 509 of 885

User Guide - Automation 26 July, 2018

DocumentGenerator Class

The DocumentGenerator Class provides an interface to thedocument and web reporting facilities, which you can use togenerate reports on specific Packages, diagrams andelements in your model. This Class is accessed from theRepository Class using the CreateDocumentGenerator()method.

DocumentGenerator Attributes

Attribute Remarks

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

DocumentGenerator Methods

Method Remarks

DocumentConnector (long

Boolean

(c) Sparx Systems 2018 Page 510 of 885

User Guide - Automation 26 July, 2018

connectorID,long nDepth,stringtemplateName)

Notes: Documents a connector.Parameters:

connectorId: Long - the ID of the·

connectornDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - the name of a·

template to use when documentingconnectors; this can be blank

DocumentCustomData(string XML,long nDepth,stringtemplateName)

BooleanNotes: Documents information based onthe data supplied.Parameters:

XML: String - the XML of the data to·

be documentednDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - the name of a·

template to use when documentingcustom data; this can be blank

DocumentDiagram (longdiagramID,long nDepth,stringtemplateNam

BooleanNotes: Documents a diagram.Parameters:

diagramId: Long - the ID of the·

diagram

(c) Sparx Systems 2018 Page 511 of 885

User Guide - Automation 26 July, 2018

e) nDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - the name of a·

template to use when documentingdiagrams; this can be blank

DocumentElement (longelementID,long nDepth,stringtemplateName)

BooleanNotes: Documents an element.Parameters:

elementId: Long - the ID of the·

elementnDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - the name of a·

template to use when documentingelements; this can be blank

DocumentModelAuthor(string name,long nDepth,stringtemplateName)

BooleanNotes: Documents a model author.Parameters:

name: String - the name of the author·

nDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - a template to·

use when documenting model authors;this can be blank

DocumentMo

(c) Sparx Systems 2018 Page 512 of 885

User Guide - Automation 26 July, 2018

delClient(string name,long nDepth,stringtemplateName)

BooleanNotes: Documents a single model client.Parameters:

name: String - the name of the client·

nDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - a template to·

use when documenting model clients;this can be blank

DocumentModelGlossary(long id, longnDepth,stringtemplateName)

BooleanNotes: Documents a single modelglossary term.Parameters:

id: Long - the ID of the term·

nDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - a template to·

use when documenting model glossaryterms; this can be blank

DocumentModelIssue(long id, longnDepth,stringtemplateName)

BooleanNotes: Documents a single model issue.Parameters:

id: Long - the ID of the issue·

nDepth: Long - the depth by which to·

adjust the heading level

(c) Sparx Systems 2018 Page 513 of 885

User Guide - Automation 26 July, 2018

templateName: String - a template to·

use when documenting model issues;this can be blank

DocumentModelResource(string name,long nDepth,stringtemplateName)

BooleanNotes: Documents a single modelresource.Parameters:

name: String - the name of the resource·

nDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - a template to·

use when documenting modelresources; this can be blank

DocumentModelRole(string name,long nDepth,stringtemplateName)

BooleanNotes: Documents a single model role.Parameters:

name: String - the name of the role·

nDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - a template to·

use when documenting model roles;this can be blank

DocumentModelTask (longid, long

BooleanNotes: Documents a single model task.

(c) Sparx Systems 2018 Page 514 of 885

User Guide - Automation 26 July, 2018

nDepth,stringtemplateName)

Parameters:id: Long - the ID of the task·

nDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - a template to·

use when documenting model tasks;this can be blank

DocumentPackage (longpackageID,long nDepth,stringtemplateName)

BooleanNotes: Documents a Package.Parameters:

packageId: Long - the ID of the·

PackagenDepth: Long - the depth by which to·

adjust the heading leveltemplateName: String - a template to·

use when documenting Packages; thiscan be blank

GetDocumentAsRTF()

Read Only.Returns a string value of the document inraw Rich Text Format.

GetProjectConstant (stringnameVal)

StringNotes: Returns the value of a ProjectConstant.Parameters:

(c) Sparx Systems 2018 Page 515 of 885

User Guide - Automation 26 July, 2018

nameVal: String - the name of the·

Project Constant for which to extractthe value.

GetLastError()

StringNotes: Returns a string value describingthe most recent error that occurred inrelation to this object.

InsertBreak(longbreakType)

BooleanNotes: Inserts a break into the report atthe current location.Parameters:

breakType: Long - 0 = page break, 1 =·

section break

InsertCoverPageDocument(stringName)

BooleanNotes: Inserts the Coverpage into thedocument at the current location.The style sheet is applied to the documentbefore it is insert into the generateddocument.Parameters:

Name: String - the name of the Cover·

page document found in the Resourcetree

InsertHyperli Boolean

(c) Sparx Systems 2018 Page 516 of 885

User Guide - Automation 26 July, 2018

nk (stringName, stringURL)

Notes: Inserts a hyperlink at the currentlocation.Parameters:Name: String - the link text to insert intothe reportURL: String - The URL of the website tolink to

InsertLinkedDocument(string guid)

BooleanNotes: Inserts a linked document into thereport at the current location.A linked document can used to set theheader and footer of the report. These aretaken from the first linked documentadded to the report.Parameters:

guid: String - the GUID of the element·

that has a linked document

InsertTableOfContents

BooleanNotes: Inserts a Table of Contents at thecurrent position.

InsertTeamReviewPost(string path)

BooleanNotes: Inserts a Team Library postinginto the report at the current location.Parameters:

path: String - the path of the Team·

(c) Sparx Systems 2018 Page 517 of 885

User Guide - Automation 26 July, 2018

Library post

InsertTemplate (stringtemplateName)

Notes: Inserts the contents of the templatedirectly into the report.Parameters:

templateName: String - the name of the·

template to use

InsertText(string text,string style)

BooleanNotes: Inserts static text into the report atthe current location.A carriage return is not included; if youneed to use one, you can add it manually.Parameters:

text: String - the static text to be·

insertedstyle: String - the name of the style in·

the template; defaults to Normal style

InsertTOCDocument(string name)

BooleanNotes: Inserts the Table of Contents intothe document at the current location.Note: The stylesheet is applied to thedocument before it is insert into thegenerated document.Parameters:

name: String - the name of the Table of·

Contents document found in the

(c) Sparx Systems 2018 Page 518 of 885

User Guide - Automation 26 July, 2018

Resource tree

LoadDocument(stringFileName)

BooleanNotes: Inserts an external document intothe currently generated file.Parameters:

FileName: String - the filename of an·

external document file to insert into thedocument.

SetProjectConstant (stringnewNameVal, stringnewValue)

BooleanNotes: Sets a Project Constant for thedocumentation generator; this is saved inthe current model.Parameters:

newNameVal: String - the name of the·

Project ConstantnewValue: String - the value of the·

Project Constant

NewDocument (stringtemplateName)

BooleanNotes: Starts a new document; you callthis before attempting to documentanything else.Parameters:

templateName: String - the name of a·

template to use when documentingelements; this can be blank

(c) Sparx Systems 2018 Page 519 of 885

User Guide - Automation 26 July, 2018

ReplaceField(stringfieldname,stringfieldvalue)

BooleanNotes: Replaces the 'Section' fieldidentified by the fieldname parameterwith the value provided in fieldvalue. Forexample: ReplaceField ("Element.Alias","MyAlias")If you call this function more than oncewith the same fieldname, the field onlyhas the most recent value set.Parameters:

fieldname: String - the field name to·

find (this does not include the {}braces)fieldvalue: String - the value to insert·

into the field; this can be a constant ora derived value

SaveDocument (stringfilename,longnDocType)

BooleanNotes: Saves the document to disk.Parameters:

filename: String - the filename to save·

the file tonDocType: Long - 0 = RTF, 1 =·

HTML, 2 = PDF,3 = DOCX

(c) Sparx Systems 2018 Page 520 of 885

User Guide - Automation 26 July, 2018

SetPageOrientation (longpageOrientation)

BooleanNotes: Sets the current page orientation.Parameters:

pageOrientation: Long - 0 = Portrait, 1·

= Landscape

SetStyleSheetDocument(string name)

BooleanNotes: Sets the Stylesheet to be used forTOC, Coverpage and templates used.This can be called before NewDocument(above).Parameters:

name: String - the name of the·

stylesheet found in the Resource tree

(c) Sparx Systems 2018 Page 521 of 885

User Guide - Automation 26 July, 2018

Mail Interface Package

The MailInterface Package contains:

A function to retrieve a pointer to the interface·

Functions to create and send a mail message within the·

current mode

Utility functions for creating hyperlinks to selected model·

elements

You can get a pointer to this interface using the methodRepository.GetMailInterface.

(c) Sparx Systems 2018 Page 522 of 885

User Guide - Automation 26 July, 2018

MailInterface Class

The MailInterface interface can be accessed from theRepository using GetMailInterface(). The returned interfaceprovides access to the Enterprise Architect Model MailInterface. Use this interface to automate the process ofcreating and sending messages using Enterprise Architect'sModel Mail system.

MailInterface Attributes

Attribute Remarks

MessagingEnabled

BooleanNotes: Read OnlyAdvises whether messaging is enabled onthe current model.

ObjectType ObjectTypeNotes: Read OnlyDistinguishes objects referenced througha dispatch interface.

MailInterface Methods

(c) Sparx Systems 2018 Page 523 of 885

User Guide - Automation 26 July, 2018

Method Remarks

ComposeMailMessage(stringInitialRecipientGUID,stringInitialSubject, messageflagInitialFlag,stringInitialMessageText)

BooleanNotes: Creates a new mail message usingthe values specified in the inputparameters; the message is displayed inthe composition window, ready forsending.This method does NOT send themessage.Parameters:

InitialRecipientGUID: String - Initial·

value for the GUID of the addresseeuser (an Enterprise Architect userdefined in the current model)InitialSubject: String - Initial value for·

the Subject text to display for thismessageInitialFlag: MessageFlag - Initial value·

for the flag type/color to attach to thismessageInitialMessageText: String - Initial·

value for the text that is the body of themessage

GetAttributeHyperlink(str

StringNotes: Returns a string containing a

(c) Sparx Systems 2018 Page 524 of 885

User Guide - Automation 26 July, 2018

ingAttributeGUID, stringLinkText)

hyperlink to the attribute specified by theinput parameter AttributeGUID.Parameters:

AttributeGUID: String - The GUID of·

the attribute for which a hyperlink isrequiredLinkText: String - The text to display·

for the hyperlink (such as the attributename)

GetDiagramHyperlink(stringDiagramGUID, stringLinkText)

StringNotes: Returns a string containing ahyperlink to the diagram specified by theinput parameter DiagramGUID.Parameters:

DiagramGUID: String - The GUID of·

the diagram for which a hyperlink isrequiredLinkText: String - The text to display·

for the hyperlink (such as the diagramname)

GetElementHyperlink(stringElementGUID, stringLinkText)

StringNotes: Returns a string containing ahyperlink to the element specified by theinput parameter ElementGUID.Parameters:

ElementGUID: String - The GUID of·

(c) Sparx Systems 2018 Page 525 of 885

User Guide - Automation 26 July, 2018

the element for which a hyperlink isrequiredLinkText: String - The text to display·

for the hyperlink (such as the elementname)

GetFileHyperlink (stringFilePath,stringLinkText)

StringNotes: Returns a string containing ahyperlink to the file specified by the inputparameter FilePath.Parameters:

FilePath: String - The path name of the·

file for which a hyperlink is requiredLinkText: String - The text to display·

for the hyperlink (such as the filename)

GetLastError()

StringNotes: Returns the last error message setfor the MailInterface.

GetMethodHyperlink(stringMethodGUID, stringLinkText)

StringNotes: Returns a string containing ahyperlink to the method specified by theinput parameter MethodGUID.Parameters:

MethodGUID: String - The GUID of·

the method for which a hyperlink is

(c) Sparx Systems 2018 Page 526 of 885

User Guide - Automation 26 July, 2018

requiredLinkText: String - The text to display·

for the hyperlink (such as the methodname)

GetPackageHyperlink(stringPackageGUID, stringLinkText)

StringNotes: Returns a string containing ahyperlink to the Package specified by theinput parameter PackageGUID.Parameters:

PackageGUID: String - The GUID of·

the Package for which a hyperlink isrequiredLinkText: String - The text to display·

for the hyperlink (such as the Packagename)

GetRecipientGUID (stringUserName)

StringNotes: Returns the GUID of the specifiedEnterprise Architect user.Parameters:

UserName: String - The name of a user·

defined in the current model

GetWebHyperlink (stringURL, stringLinkText)

StringNotes: Returns a string containing ahyperlink to the URL specified by theinput parameter URL.

(c) Sparx Systems 2018 Page 527 of 885

User Guide - Automation 26 July, 2018

Parameters:URL: String - The URL of the item for·

which a hyperlink is requiredLinkText: String - The text to display·

for the hyperlink

SendMailMessage (stringRecipientGUID, stringSubject,messageflagFlag, stringMessageText)

BooleanNotes: Creates and sends a new mailmessage using the values specified in theinput parameters.Parameters:

RecipientGUID: String - The GUID of·

the addressee user (an EnterpriseArchitect user defined in the currentmodel)Subject: String - The Subject text to·

display for this messageFlag: MessageFlag - The flag·

type/color to attach to this messageMessageText: String - The text that is·

the body of the message

(c) Sparx Systems 2018 Page 528 of 885

User Guide - Automation 26 July, 2018

Simulation Package

The Simulation Package contains:

An attribute to set, increase and decrease the speed of the·

simulation

A function to check if a simulation is currently running·

Functions to Start, Stop, Step Into, Step Out of, Step Over·

and Pause a simulation

A function to send a broadcast signal to the simulation·

that is currently running

(c) Sparx Systems 2018 Page 529 of 885

User Guide - Automation 26 July, 2018

Simulation Class

The Simulation Class provides an interface to the EnterpriseArchitect Model Simulation facilities.

Simulation Attributes

Attribute Description

ObjectType ObjectTypeNotes: Read onlyDistinguishes objects referenced througha Dispatch interface.

Speed LongNotes: Read/WriteRetrieve or set the current simulationrunning speed.

Simulation Methods

Method Description

(c) Sparx Systems 2018 Page 530 of 885

User Guide - Automation 26 July, 2018

BroadcastSignal(stringsSignalName,stringsParameters)

BooleanNotes: Send a signal into the runningsimulation. If the simulation is stopped,do nothing.Parameters:

sSignalName: String - the name of the·

signal OR the GUID of the SignalelementsParameters: String - a string of one or·

more signal parameters, in this format:{parameter1: 5, parameter2: "test",parameter3: 3.2}

IsSimulatorRunning()

BooleanNotes: Check the state of the simulation.Returns True if the simulation is running;returns False if the simulation is stopped.

Pause() BooleanNotes: Pause the simulation if it isrunning.

Start() BooleanNotes: Start the simulation based on thecurrent selection. If the current simulationis in a paused state, then the simulation isresumed.

(c) Sparx Systems 2018 Page 531 of 885

User Guide - Automation 26 July, 2018

StepIn() BooleanNotes: Step In to the routine in thecurrent simulation.

StepOut() BooleanNotes: Step Out of the routine in thecurrent simulation.

StepOver() BooleanNotes: Step Over the routine in thecurrent simulation.

Stop() BooleanNotes: Stop the simulation.

(c) Sparx Systems 2018 Page 532 of 885

User Guide - Automation 26 July, 2018

Schema Composer Package

The Schema Composer can be accessed from the EnterpriseArchitect automation interface. A client (script or Add-In)can obtain access to the interface using theSchemaComposer property of the Repository object. Thisinterface is available when a Schema Composer has aprofile loaded.

(c) Sparx Systems 2018 Page 533 of 885

User Guide - Automation 26 July, 2018

SchemaProperty Class

SchemaProperty Attributes

Attribute Description

TypeID longNotes: Read onlyThe classifier ID of the property.

PropID longNotes: Read onlyThe property ID.

Guid stringNotes: Read onlyThe unique model GUID of the property.

Name stringNotes: Read onlyThe name of the property.

Cardinality stringNotes: Read onlyThe cardinality of the element.

(c) Sparx Systems 2018 Page 534 of 885

User Guide - Automation 26 July, 2018

UMLType stringNotes: Read onlyThe UML type, such as attribute,association or aggregation.

Parent longNotes: Read onlyThe classifier of the owner Class.

PrimitiveType

stringNotes: Read onlyThe property's primitive type if propertyrepresents a simple type.

Annotation stringNotes: Read onlyThe model notes for the property.

Stereotype stringNotes: Read onlyThe stereotype of the property.

Choices SchemaTypeEnumReturns an iterator allowing navigation ofchoice elements defined for this propertyin the Schema Composer

(c) Sparx Systems 2018 Page 535 of 885

User Guide - Automation 26 July, 2018

TypeName stringReturns a string naming the type of theproperty

Type SchemaTypeReturns an interface to the property's typefor complex types.

SchemaProperty Methods

Method Description

IsInline booleanIf true, the property is marked as 'Inline'.XML schema generators would emit aninline definition when detecting thisattribute.

IsPrimitive booleanReturns true for a property whose type ismaps to a built in type such as xs:integer,xs:string, xs:date or other XML Schemabuilt-in type.

IsByReferenc boolean

(c) Sparx Systems 2018 Page 536 of 885

User Guide - Automation 26 July, 2018

e Returns true for a property marked as 'ByReference' in the profile.

(c) Sparx Systems 2018 Page 537 of 885

User Guide - Automation 26 July, 2018

SchemaComposer Class

The SchemaComposer Class provides the interface to theEnterprise Architect Schema Composer facility.

SchemaComposer Attributes

Attribute Description

ModelReference

StringNotes: The model ref listed in theSchema Composer for the current profile.

Namespace StringNotes: The namespace listed in theSchema Composer for the current profile.

NamespacePrefix

StringNotes: The namespace prefix listed in theSchema Composer for the current profile.

TargetDirectory

StringNotes: The target directory selected bythe user after clicking on the Generatebutton.

(c) Sparx Systems 2018 Page 538 of 885

User Guide - Automation 26 July, 2018

SchemaName StringNotes: Returns the name of the schemaprofile currently being generated.

SchemaSet StringNotes: Returns the schema set used whenthe schema was created.

SchemaType StringNotes: The schema type listed in theSchema Composer for the current profile,either 'schema' or 'transform'.

SchemaTypes

SchemaTypeEnumNotes: Read onlyEnumerator for the type collectionrepresented in the currently open schema.

SchemaComposer Methods

Method Description

FindInSchema(longtypeID)

SchemaTypeNotes: Obtains an interface to a Class asrepresented in the schema for a given

(c) Sparx Systems 2018 Page 539 of 885

User Guide - Automation 26 July, 2018

model class ID.Parameters:

typeID: the model Class ID·

FindInModel(long typeID)

ModelTypeNotes: Obtains an interface to a Class asrepresented in the UML model for agiven model Class IDParameters:

typeID: the model Class ID·

FindSchemaTypeByName(stringtypename)

SchemaTypeNotes: Returns an interface to the schematype that matches the type specified ornull if no type exists.Parameters:

name : the name of the type·

(c) Sparx Systems 2018 Page 540 of 885

User Guide - Automation 26 July, 2018

SchemaProfile Class

The interface representing the technology governing thenaming and design rules on which the schema is built.

SchemaProfile Methods

Method Description

AddExportFormat(stringdescription)

voidNotes: Use this function to add entriesthat are offered by the Schema Composerwhen the user clicks on the Generatebutton.Parameters:

description: describes the export format·

provided by the Add-in

SetCapability(stringname,boolean enabled)

voidNotes: Use this function to enable/disablecapabilities.Parameters:

name: name of the capability·

enabled: True or False·

Capabilities:

(c) Sparx Systems 2018 Page 541 of 885

User Guide - Automation 26 July, 2018

'allowCardinality' - allows/deniesrestrictions to cardinality'allowRootElement' - allows/deniessetting root element'allowPropByRef' - allows/denies ByReference restriction'allowRedefine' - allows/denies ability toredefine an element

SetProperty(string name,string value)

voidNotes: Sets properties displayed in theSchema Composer.Parameters:

name: property name·

value: property value·

Properties:'Namespace' - Target namespace forXML schema'Namespace Prefix' - Namespace prefixfor XML schema'Qualifier' - string qualifier that prependsschema type names

(c) Sparx Systems 2018 Page 542 of 885

User Guide - Automation 26 July, 2018

ModelType Class

Provides an interface to the Class of a schema type asrepresented in the model.

ModelType Attributes

Attribute Description

PropertyCount

longNotes: Read onlyThe total number of properties for thisClass available in the Propertiescollection.

Properties SchemaPropEnumNotes: EnumeratorCollection of properties for the Class asdefined in the model.

TypeID longNotes: Read onlyThe Class ID of the type.

Guid stringNotes: Read only

(c) Sparx Systems 2018 Page 543 of 885

User Guide - Automation 26 July, 2018

A GUID that uniquely identifies a type inthe model.

Typename stringNotes: Read onlyThe name of the type as represented inthe model.

ClassifierPath

stringNotes: Read onlyThe qualified path of the type in themodel.

ClassifierPathID

stringNotes: Read onlyA GUID that uniquely identifies aClassifierPath in the model.

Stereotype stringNotes: Read onlyThe stereotype of the Class as defined inthe model.

Annotation stringNotes: Read onlyAny notes present in the modeldescribing the Class.

(c) Sparx Systems 2018 Page 544 of 885

User Guide - Automation 26 July, 2018

ModelType Methods

Method Description

GetSuperClassEnum(SearchTypesearchtype)

ModelTypeEnumNotes: EnumeratorReturns an enumerator that can be used totraverse the Class ancestry.Parameters:

searchtype: the type of traversal to use,·

breadth first or depth first

GetSubClassEnum(SearchTypesearchType)

ModelTypeEnumNotes: EnumeratorReturns an enumerator that can be used toiterate over any descendents of the Class.Parameters:

searchtype: the type of traversal to use,·

breadth first or depth first

(c) Sparx Systems 2018 Page 545 of 885

User Guide - Automation 26 July, 2018

ModelTypeEnum Class

An enumerator interface for schema types as represented inthe UML model.

ModelTypeEnum Methods

Method Description

GetCount() longReturns the number of types present inthe collection.

GetFirst() ModelTypeReturns the first type interface in acollection of types.

GetNext() ModelTypeReturns the next type in the collection oftypes or null if end is reached.

(c) Sparx Systems 2018 Page 546 of 885

User Guide - Automation 26 July, 2018

SchemaType Class

Represents a type as it is defined in the schema.

Methods

Method Description

GetFacet(BSTR name)

Returns the value of the named facet.'Root', for example' returns a valueindicating whether a type is a rootelement.

GetRestriction(BSTRguid)

Returns the restriction as a string for theproperty having the supplied guid.

IsRoot() True if class is marked as 'root' in theComposer.

Properties

Property Description

(c) Sparx Systems 2018 Page 547 of 885

User Guide - Automation 26 July, 2018

PropertyCount [type:long]

Returns the number of properties held by'type'.

Properties[type:IEASchemaPropEnum]

Returns an enumerator for 'type's'properties.

TypeID The model class ID.

Guid The unique model GUID of the type.

Typename The type's name.

Parent The parent type if any that this classextends. May be null depending oncomposition method.

(c) Sparx Systems 2018 Page 548 of 885

User Guide - Automation 26 July, 2018

SchemaTypeEnum Class

An enumerator interface for schema types as represented inXML schema.

Methods

Method Description

GetCount() Returns the number of properties for anelement.

GetFirst() Returns the first property for the elementin alphabetical order.

GetNext() Returns the first property for the elementin alphabetical order or null if no moreare present.

(c) Sparx Systems 2018 Page 549 of 885

User Guide - Automation 26 July, 2018

SchemaPropEnum Class

An enumerator for properties of a UML model type or XMLschema type.

Methods

Method Description

GetCount() Returns the number of properties for anelement.

GetFirst() Returns the first property for the elementin alphabetical order.

GetNext() Returns the first property for the elementin alphabetical order or null if no moreare present.

(c) Sparx Systems 2018 Page 550 of 885

User Guide - Automation 26 July, 2018

SearchType Enumeration

SearchType Attributes

Attribute Description

searchDepthFirst

Navigate children before siblings.

searchBreadthFirst

Navigate siblings before children.

(c) Sparx Systems 2018 Page 551 of 885

User Guide - Automation 26 July, 2018

Code Samples

As you write or edit code for using the AutomationInterface, you might want to review these public Objectexamples, written in VB.Net.

Examples

Name

Open the Repository

Iterate Through a .eap File

Add and Manage Packages

Add and Manage Elements

Add a Connector

Add and Manage Diagrams

Add and Delete Features

Element Extras

(c) Sparx Systems 2018 Page 552 of 885

User Guide - Automation 26 July, 2018

Repository Extras

Stereotypes

Work with Attributes

Work with Methods

(c) Sparx Systems 2018 Page 553 of 885

User Guide - Automation 26 July, 2018

Open the Repository

This is an example of the VB.Net code to open an EnterpriseArchitect repository.

Public Class AutomationExample

''Class level variable for Repository

Public m_Repository As Object

Public Sub Run()

try

''create the repository object

m_Repository = CreateObject("EA.Repository")

''open an EAP file

m_Repository.OpenFile("F:\Test\EAAuto.EAP")

''use the Repository in any way required

''DumpModel

''close the repository and tidy up

m_Repository.Exit()

m_Repository = Nothing

(c) Sparx Systems 2018 Page 554 of 885

User Guide - Automation 26 July, 2018

catch e as exception

Console.WriteLine(e)

End try

End Sub

end Class

(c) Sparx Systems 2018 Page 555 of 885

User Guide - Automation 26 July, 2018

Iterate Through a .EAP File

This is an example of the VB.Net code to iterate through a.eap file starting at the Model level, after the repository hasbeen opened.

Sub DumpModel()

Dim idx as Integer

For idx=0 to m_Repository.Models.Count-1

DumpPackage("",m_Repository.Models.GetAt(idx))

Next

End Sub

''output package name, then element contents, then processchild Packages

Sub DumpPackage(Indent as String, Package as Object)

Dim idx as Integer

Console.WriteLine(Indent + Package.Name)

DumpElements(Indent + "    ", Package)

For idx = 0 to Package.Packages.Count-1

DumpPackage(Indent + "    ",Package.Packages.GetAt(idx))

Next

End Sub

(c) Sparx Systems 2018 Page 556 of 885

User Guide - Automation 26 July, 2018

''dump element name

Sub DumpElements(Indent as String, Package as Object)

Dim idx as Integer

For idx = 0 to Package.Elements.Count-1

Console.WriteLine(Indent + "::" +Package.Elements.GetAt(idx).Name)

Next

End Sub

(c) Sparx Systems 2018 Page 557 of 885

User Guide - Automation 26 July, 2018

Add and Manage Packages

This example illustrates how to add a Model or a Package tothe project.

Sub TestPackageLifecycle

Dim idx as integer

Dim idx2 as integer

Dim package as object

Dim model as object

Dim o as object

''first add a new Model

model =m_Repository.Models.AddNew("AdvancedModel","")

If not model.Update() Then

Console.WriteLine(model.GetLastError())

End If

''refresh the models collection

m_Repository.Models.Refresh

''now work through models collection and add a package

(c) Sparx Systems 2018 Page 558 of 885

User Guide - Automation 26 July, 2018

For idx = 0 to m_Repository.Models.Count -1

o = m_Repository.Models.GetAt(idx)

Console.WriteLine(o.Name)

If o.Name = "AdvancedModel" Then

package =o.Packages.Addnew("Subpackage","Nothing")

If not package.Update() Then

Console.WriteLine(package.GetLastError())

End If

package.Element.Stereotype = "system"

package.Update

''for testing purposes just delete the

''newly created Model and its contents

"m_Repository.Models.Delete(idx)

End If

Next

End Sub

(c) Sparx Systems 2018 Page 559 of 885

User Guide - Automation 26 July, 2018

Add and Manage Elements

This is an example of the code for adding and deletingelements in a Package.

Sub ElementLifeCycle

Dim package as Object

Dim element as Object

package = m_Repository.GetPackageByID(2)

element = package.elements.AddNew("Login toWebsite","UseCase")

element.Stereotype = "testcase"

element.Update

package.elements.Refresh()

Dim idx as integer

''Note the repeated calls to "package.elements.GetAt."

''In general you should make this call once and assignto a local

''variable - in this example, Enterprise Architect loadsthe

''element required every time a call is made - ratherthan loading once

(c) Sparx Systems 2018 Page 560 of 885

User Guide - Automation 26 July, 2018

''and keeping a local reference.

For idx = 0 to package.elements.count-1

Console.WriteLine(package.elements.GetAt(idx).Name)

If (package.elements.GetAt(idx).Name = "Login toWebsite" and _

package.elements.GetAt(idx).Type ="UseCase") Then

package.elements.deleteat(idx, false)

End If

Next

End Sub

(c) Sparx Systems 2018 Page 561 of 885

User Guide - Automation 26 July, 2018

Add a Connector

This is an example of code to add a connector and set itsvalues.

Sub ConnectorTest

Dim source as object

Dim target as object

Dim con as object

Dim o as object

Dim client as object

Dim supplier as object

''Use ElementIDs to quickly load an element in thisexample

''... you must find suitable IDs in your model

source = m_Repository.GetElementByID(129)

target = m_Repository.GetElementByID(169)

con = source.Connectors.AddNew ("test link 2","Association")

''again, replace ID with a suitable one from your model

(c) Sparx Systems 2018 Page 562 of 885

User Guide - Automation 26 July, 2018

con.SupplierID = 169

If not con.Update Then

Console.WriteLine(con.GetLastError)

End If

source.Connectors.Refresh

Console.WriteLine("Connector Created")

o = con.Constraints.AddNew ("constraint2","type")

If not o.Update Then

Console.WriteLine(o.GetLastError)

End If

o = con.TaggedValues.AddNew ("Tag","Value")

If not o.Update Then

Console.WriteLine(o.GetLastError)

End If

''Use the client and supplier ends to set

''additional information

client = con.ClientEnd

client.Visibility = "Private"

client.Role = "m_client"

(c) Sparx Systems 2018 Page 563 of 885

User Guide - Automation 26 July, 2018

client.Update

supplier = con.SupplierEnd

supplier.Visibility = "Protected"

supplier.Role = "m_supplier"

supplier.Update

Console.WriteLine("Client and Supplier set")

Console.WriteLine(client.Role)

Console.WriteLine(supplier.Role)

End Sub

(c) Sparx Systems 2018 Page 564 of 885

User Guide - Automation 26 July, 2018

Add and Manage Diagrams

This is an example of the code for creating a diagram andadding an element to it. Note the optional use of the elementrectangle setting using left, right, top and bottom dimensionsin the AddNew call.

Sub DiagramLifeCycle

Dim diagram as object

Dim v as object

Dim o as object

Dim package as object

Dim idx as Integer

Dim idx2 as integer

package = m_Repository.GetPackageByID(5)

diagram = package.Diagrams.AddNew("LogicalDiagram","Logical")

If not diagram.Update Then

Console.WriteLine(diagram.GetLastError)

End if

(c) Sparx Systems 2018 Page 565 of 885

User Guide - Automation 26 July, 2018

diagram.Notes = "Hello there this is a test"

diagram.update()

o =package.Elements.AddNew("ReferenceType","Class")

o.Update

'' add element to diagram - supply optional rectangleco-ordinates

v =diagram.DiagramObjects.AddNew("l=200;r=400;t=200;b=600;","")

v.ElementID = o.ElementID

v.Update

Console.WriteLine(diagram.DiagramID)

End Sub

(c) Sparx Systems 2018 Page 566 of 885

User Guide - Automation 26 July, 2018

Add and Delete Features

An example of code to add and delete Features of an object.

Dim element as object

Dim idx as integer

Dim attribute as object

Dim method as object

'just load an element by ID - you must

'substitute a valid ID from your model

element = m_Repository.GetElementByID(246)

''create a new method

method = element.Methods.AddNew("newMethod","int")

method.Update

element.Methods.Refresh

'now loop through methods for Element - and delete ouraddition

For idx = 0 to element.Methods.Count-1

method =element.Methods.GetAt(idx)

Console.Writeline(method.Name)

If(method.Name = "newMethod") Then

(c) Sparx Systems 2018 Page 567 of 885

User Guide - Automation 26 July, 2018

element.Methods.Delete(idx)

End if

Next

'create an attribute

attribute = element.attributes.AddNew("NewAttribute","int")

attribute.Update

element.attributes.Refresh

'loop through and delete our new attribute

For idx = 0 to element.attributes.Count-1

attribute =element.attributes.GetAt(idx)

Console.Writeline(attribute.Name)

If(attribute.Name = "NewAttribute") Then

element.attributes.Delete(idx)

End If

Next

(c) Sparx Systems 2018 Page 568 of 885

User Guide - Automation 26 July, 2018

Element Extras

These are examples of code to access and use elementextras, such as scenarios, constraints and requirements.

Sub ElementExtras

Dim element as object

Dim o as object

Dim idx as Integer

Dim bDel as boolean

bDel = true

try

element = m_Repository.GetElementByID(129)

'manage constraints for an element

'demonstrate addnew and delete

o =element.Constraints.AddNew("Appended","Type")

If not o.Update Then

Console.WriteLine("Constraint error:" +o.GetLastError())

End if

element.Constraints.Refresh

(c) Sparx Systems 2018 Page 569 of 885

User Guide - Automation 26 July, 2018

For idx = 0 to element.Constraints.Count -1

o = element.Constraints.GetAt(idx)

Console.WriteLine(o.Name)

If(o.Name="Appended") Then

If bDel Then element.Constraints.Delete (idx)

End if

Next

'efforts

o = element.Efforts.AddNew("Appended","Type")

If not o.Update Then

Console.WriteLine("Efforts error:" +o.GetLastError())

End if

element.Efforts.Refresh

For idx = 0 to element.Efforts.Count -1

o = element.Efforts.GetAt(idx)

Console.WriteLine(o.Name)

If(o.Name="Appended") Then

If bDel Then element.Efforts.Delete (idx)

End if

Next

'Risks

o = element.Risks.AddNew("Appended","Type")

(c) Sparx Systems 2018 Page 570 of 885

User Guide - Automation 26 July, 2018

If not o.Update Then

Console.WriteLine("Risks error:" +o.GetLastError())

End if

element.Risks.Refresh

For idx = 0 to element.Risks.Count -1

o = element.Risks.GetAt(idx)

Console.WriteLine(o.Name)

If(o.Name="Appended") Then

If bDel Then element.Risks.Delete (idx)

End if

Next

'Metrics

o = element.Metrics.AddNew("Appended","Change")

If not o.Update Then

Console.WriteLine("Metrics error:" +o.GetLastError())

End if

element.Metrics.Refresh

For idx = 0 to element.Metrics.Count -1

o = element.Metrics.GetAt(idx)

Console.WriteLine(o.Name)

If(o.Name="Appended") Then

If bDel Then element.Metrics.Delete (idx)

(c) Sparx Systems 2018 Page 571 of 885

User Guide - Automation 26 July, 2018

End if

Next

'TaggedValues

o =element.TaggedValues.AddNew("Appended","Change")

If not o.Update Then

Console.WriteLine("TaggedValues error:" +o.GetLastError())

End if

element.TaggedValues.Refresh

For idx = 0 to element.TaggedValues.Count -1

o = element.TaggedValues.GetAt(idx)

Console.WriteLine(o.Name)

If(o.Name="Appended") Then

If bDel Then element.TaggedValues.Delete(idx)

End if

Next

'Scenarios

o =element.Scenarios.AddNew("Appended","Change")

If not o.Update Then

Console.WriteLine("Scenarios error:" +

(c) Sparx Systems 2018 Page 572 of 885

User Guide - Automation 26 July, 2018

o.GetLastError())

End if

element.Scenarios.Refresh

For idx = 0 to element.Scenarios.Count -1

o = element.Scenarios.GetAt(idx)

Console.WriteLine(o.Name)

If(o.Name="Appended") Then

If bDel Then element.Scenarios.Delete (idx)

End if

Next

'Files

o = element.Files.AddNew("MyFile","doc")

If not o.Update Then

Console.WriteLine("Files error:" +o.GetLastError())

End if

element.Files.Refresh

For idx = 0 to element.Files.Count -1

o = element.Files.GetAt(idx)

Console.WriteLine(o.Name)

If(o.Name="MyFile") Then

If bDel Then element.Files.Delete (idx)

End if

Next

(c) Sparx Systems 2018 Page 573 of 885

User Guide - Automation 26 July, 2018

'Tests

o = element.Tests.AddNew("TestPlan","Load")

If not o.Update Then

Console.WriteLine("Tests error:" +o.GetLastError())

End if

element.Tests.Refresh

For idx = 0 to element.Tests.Count -1

o = element.Tests.GetAt(idx)

Console.WriteLine(o.Name)

If(o.Name="TestPlan") Then

If bDel Then element.Tests.Delete (idx)

End if

Next

'Defect

o = element.Issues.AddNew("Broken","Defect")

If not o.Update Then

Console.WriteLine("Issues error:" +o.GetLastError())

End if

element.Issues.Refresh

For idx = 0 to element.Issues.Count -1

o = element.Issues.GetAt(idx)

(c) Sparx Systems 2018 Page 574 of 885

User Guide - Automation 26 July, 2018

Console.WriteLine(o.Name)

If(o.Name="Broken") Then

If bDel Then element.Issues.Delete (idx)

End if

Next

'Change

o = element.Issues.AddNew("Change","Change")

If not o.Update Then

Console.WriteLine("Issues error:" +o.GetLastError())

End if

element.Issues.Refresh

For idx = 0 to element.Issues.Count -1

o = element.Issues.GetAt(idx)

Console.WriteLine(o.Name)

If(o.Name="Change") Then

If bDel Then element.Issues.Delete (idx)

End if

Next

catch e as exception

Console.WriteLine(element.Methods.GetLastError())

Console.WriteLine(e)

End try

(c) Sparx Systems 2018 Page 575 of 885

User Guide - Automation 26 July, 2018

End Sub

(c) Sparx Systems 2018 Page 576 of 885

User Guide - Automation 26 July, 2018

Repository Extras

These are examples of code for accessing repositorycollections for system-level information.

Sub RepositoryExtras

Dim o as object

Dim idx as integer

'issues

o = m_Repository.Issues.AddNew("Problem","Type")

If(o.Update=false) Then

Console.WriteLine (o.GetLastError())

End if

o = nothing

m_Repository.Issues.Refresh

For idx = 0 to m_Repository.Issues.Count-1

Console.Writeline(m_Repository.Issues.GetAt(idx).Name)

If(m_Repository.Issues.GetAt(idx).Name ="Problem") then

m_Repository.Issues.DeleteAt(idx,false)

Console.WriteLine("Delete Issues")

End if

(c) Sparx Systems 2018 Page 577 of 885

User Guide - Automation 26 July, 2018

Next

''tasks

o = m_Repository.Tasks.AddNew("Task 1","Task type")

If(o.Update=false) Then

Console.WriteLine ("error - " + o.GetLastError())

End if

o = nothing

m_Repository.Tasks.Refresh

For idx = 0 to m_Repository.Tasks.Count-1

Console.Writeline(m_Repository.Tasks.GetAt(idx).Name)

If(m_Repository.Tasks.GetAt(idx).Name = "Task 1")then

m_Repository.Tasks.DeleteAt(idx,false)

Console.WriteLine("Delete Tasks")

End if

Next

''glossary

o = m_Repository.Terms.AddNew("Term 1","business")

If(o.Update=false) Then

Console.WriteLine ("error - " + o.GetLastError())

End if

o = nothing

(c) Sparx Systems 2018 Page 578 of 885

User Guide - Automation 26 July, 2018

m_Repository.Terms.Refresh

For idx = 0 to m_Repository.Terms.Count-1

Console.Writeline(m_Repository.Terms.GetAt(idx).Term)

If(m_Repository.Terms.GetAt(idx).Term = "Term 1")then

m_Repository.Terms.DeleteAt(idx,false)

Console.WriteLine("Delete Terms")

End if

Next

'authors

o = m_Repository.Authors.AddNew("Joe B","Writer")

If(o.Update=false) Then

Console.WriteLine (o.GetLastError())

End if

o = nothing

m_Repository.Authors.Refresh

For idx = 0 to m_Repository.authors.Count-1

Console.Writeline(m_Repository.Authors.GetAt(idx).Name)

If(m_Repository.authors.GetAt(idx).Name = "Joe B")then

m_Repository.authors.DeleteAt(idx,false)

Console.WriteLine("Delete Authors")

(c) Sparx Systems 2018 Page 579 of 885

User Guide - Automation 26 July, 2018

End if

Next

o = m_Repository.Clients.AddNew("JoeSphere","Client")

If(o.Update=false) Then

Console.WriteLine (o.GetLastError())

End if

o = nothing

m_Repository.Clients.Refresh

For idx = 0 to m_Repository.Clients.Count-1

Console.Writeline(m_Repository.Clients.GetAt(idx).Name)

If(m_Repository.Clients.GetAt(idx).Name = "JoeSphere") then

m_Repository.Clients.DeleteAt(idx,false)

Console.WriteLine("Delete Clients")

End if

Next

o = m_Repository.Resources.AddNew("JoeWorker","Resource")

If(o.Update=false) Then

Console.WriteLine (o.GetLastError())

End if

o = nothing

(c) Sparx Systems 2018 Page 580 of 885

User Guide - Automation 26 July, 2018

m_Repository.Resources.Refresh

For idx = 0 to m_Repository.Resources.Count-1

Console.Writeline(m_Repository.Resources.GetAt(idx).Name)

If(m_Repository.Resources.GetAt(idx).Name = "JoeWorker") then

m_Repository.Resources.DeleteAt(idx,false)

Console.WriteLine("Delete Resources")

End if

Next

End Sub

(c) Sparx Systems 2018 Page 581 of 885

User Guide - Automation 26 July, 2018

Stereotypes

This is some example code for adding and deletingstereotypes.

Sub TestStereotypes

Dim o as object

Dim idx as integer

''add a new stereotype to the Stereotypes collection

o =m_Repository.Stereotypes.AddNew("funky","class")

If(o.Update=false) Then

Console.WriteLine (o.GetLastError())

End if

o = nothing

''make sure you refresh

m_Repository.Stereotypes.Refresh

''then iterate through - deleting our new entry in theprocess

For idx = 0 to m_Repository.Stereotypes.Count-1

(c) Sparx Systems 2018 Page 582 of 885

User Guide - Automation 26 July, 2018

Console.Writeline(m_Repository.Stereotypes.GetAt(idx).Name)

If(m_Repository.Stereotypes.GetAt(idx).Name ="funky") then

m_Repository.Stereotypes.DeleteAt(idx,false)

Console.WriteLine("Delete element")

End if

Next

End Sub

(c) Sparx Systems 2018 Page 583 of 885

User Guide - Automation 26 July, 2018

Work With Attributes

This is an example of code for working with attributes.

Sub AttributeLifecycle

Dim element as object

Dim o as object

Dim t as object

Dim idx as Integer

Dim idx2 as integer

try

element = m_Repository.GetElementByID(129)

For idx = 0 to element.Attributes.Count -1

Console.WriteLine("attribute=" +element.Attributes.GetAt(idx).Name)

o = element.Attributes.GetAt(idx)

t = o.Constraints.AddNew("> 123","Precision")

t.Update()

o.Constraints.Refresh

For idx2 = 0 to o.Constraints.Count-1

(c) Sparx Systems 2018 Page 584 of 885

User Guide - Automation 26 July, 2018

t = o.Constraints.GetAt(idx2)

Console.WriteLine("Constraint: " + t.Name)

If(t.Name="> 123") Then

o.Constraints.DeleteAt(idx2, false)

End if

Next

For idx2 = 0 to o.TaggedValues.Count-1

t = o.TaggedValues.GetAt(idx2)

If(t.Name = "Type2") Then

'Console.WriteLine("deleteing")

o.TaggedValues.DeleteAt(idx2, true)

End if

Next

t =o.TaggedValues.AddNew("Type2","Number")

t.Update

o.TaggedValues.Refresh

For idx2 = 0 to o.TaggedValues.Count-1

t = o.TaggedValues.GetAt(idx2)

Console.WriteLine("Tagged Value: " +t.Name)

Next

(c) Sparx Systems 2018 Page 585 of 885

User Guide - Automation 26 July, 2018

If(element.Attributes.GetAt(idx).Name ="m_Tootle") Then

Console.WriteLine("delete attribute")

element.Attributes.DeleteAt(idx, false)

End If

Next

catch e as exception

Console.WriteLine(element.Attributes.GetLastError())

Console.WriteLine(e)

End try

End Sub

(c) Sparx Systems 2018 Page 586 of 885

User Guide - Automation 26 July, 2018

Work With Methods

This is an example of code for working with the Methodscollection of an element and with Method collections.

Sub MethodLifeCycle

Dim element as object

Dim method as object

Dim t as object

Dim idx as Integer

Dim idx2 as integer

try

element = m_Repository.GetElementByID(129)

For idx = 0 to element.Methods.Count -1

method = element.Methods.GetAt(idx)

Console.WriteLine(method.Name)

t =method.PreConditions.AddNew("TestConstraint","something")

If t.Update = false Then

Console.WriteLine("PreConditions: " +

(c) Sparx Systems 2018 Page 587 of 885

User Guide - Automation 26 July, 2018

t.GetLastError)

End if

method.PreConditions.Refresh

For idx2 = 0 to method.PreConditions.Count-1

t = method.PreConditions.GetAt(idx2)

Console.WriteLine("PreConditions: " +t.Name)

If t.Name = "TestConstraint" Then

method.PreConditions.DeleteAt(idx2,false)

End If

Next

t =method.PostConditions.AddNew("TestConstraint","something")

If t.Update = false Then

Console.WriteLine("PostConditions: " +t.GetLastError)

End if

method.PostConditions.Refresh

For idx2 = 0 to method.PostConditions.Count-1

t = method.PostConditions.GetAt(idx2)

Console.WriteLine("PostConditions: " +

(c) Sparx Systems 2018 Page 588 of 885

User Guide - Automation 26 July, 2018

t.Name)

If t.Name = "TestConstraint" Then

method.PostConditions.DeleteAt(idx2,false)

End If

Next

t =method.TaggedValues.AddNew("TestTaggedValue","something")

If t.Update = false Then

Console.WriteLine("Tagged Values: " +t.GetLastError)

End if

For idx2 = 0 to method.TaggedValues.Count-1

t = method.TaggedValues.GetAt(idx2)

Console.WriteLine("Tagged Value: " +t.Name)

If(t.Name= "TestTaggedValue") Then

method.TaggedValues.DeleteAt(idx2,false)

End If

Next

t =

(c) Sparx Systems 2018 Page 589 of 885

User Guide - Automation 26 July, 2018

method.Parameters.AddNew("TestParam","string")

If t.Update = false Then

Console.WriteLine("Parameters: " +t.GetLastError)

End if

method.Parameters.Refresh

For idx2 = 0 to method.Parameters.Count-1

t = method.Parameters.GetAt(idx2)

Console.WriteLine("Parameter: " + t.Name)

If(t.Name="TestParam") Then

method.Parameters.DeleteAt(idx2, false)

End If

Next

method = nothing

Next

catch e as exception

Console.WriteLine(element.Methods.GetLastError())

Console.WriteLine(e)

End try

End Sub

(c) Sparx Systems 2018 Page 590 of 885

User Guide - Automation 26 July, 2018

Enterprise Architect Add-In Model

The Add-In facility provides a means of extendingEnterprise Architect, allowing the programmer to enhancethe user interface by adding new menus, sub menus,windows and other controls to perform a variety offunctions. An Add-In is an ActiveX COM object that isnotified of events in the user interface, such as mouse clicksand element selections, and has access to the repositorycontent through the Object Model. Add-Ins can also beintegrated with the license management system.

Using this powerful facility, you can extend EnterpriseArchitect to create new features not available in the coreproduct, and these can be compiled and easily distributed toa community of users within an organization, or morebroadly to an entire industry. Using the Add-In facility it iseven possible to create support for modeling languages andframeworks not supported in the core product.

Add-Ins have several advantages over stand-aloneautomation clients:

Add-Ins can (and should) be written as in-process (DLL)·

components; this provides lower call overhead and betterintegration into the Enterprise Architect environment

Because a current version of Enterprise Architect is·

(c) Sparx Systems 2018 Page 591 of 885

User Guide - Automation 26 July, 2018

already running there is no requirement to start a secondcopy of Enterprise Architect via the automation interface

Because the Add-In receives object handles associated·

with the currently running copy of Enterprise Architect,more information is available about the current user'sactivity; for example, which diagram objects are selected

You are not required to do anything other than to install·

the Add-In to make it usable; that is, you do not have toconfigure Add-Ins to run on your systems

Because Enterprise Architect is constantly evolving in·

response to customer requests, the Add-In interface isflexible

The Add-In interface does not have its own version, rather·

it is identified by the version of Enterprise Architect itfirst appeared in; for example, the current version of theEnterprise Architect Add-In interface is version 2.1

When creating your Add-In, you do not have to subscribe·

to a type-library (Add-Ins created before 2004 are nolonger supported - if an Add-In subscribes to theAddn_Tmpl.tlb interface (2003 style), it fails on load; inthis event, contact the vendor or author of the Add-In andrequest an upgrade)

Add-Ins do not have to implement methods that they·

never use

Add-Ins prompt users via context menus in the tree view·

and the diagram

Menu check and disable states can be controlled by the·

Add-In

(c) Sparx Systems 2018 Page 592 of 885

User Guide - Automation 26 July, 2018

Add-Ins enhance the existing functionality of EnterpriseArchitect through a variety of mechanisms, such as Scripts,UML Profiles and the Automation Interface. Once anAdd-In is registered, it can be managed using the Add-InManager.

(c) Sparx Systems 2018 Page 593 of 885

User Guide - Automation 26 July, 2018

The Add-In Manager

If you want to check what Add-Ins are available on yoursystem, and enable or disable them for use, you can reviewthe 'Add-In Manager' dialog. This dialog lists the Add-Insthat have been registered on your system, and their currentstatus (Enabled or Disabled).

Access

Ribbon Specialize > Add-Ins > Manage

Enable/disable Add-Ins

Action Detail

Enable anAdd-In

To enable an Add-In so that it is availablefor use, select the 'Load on Startup'checkbox corresponding to the name.Click on the OK button.

Any Add-In specific features, facilities·

and Help are made available throughthe 'Specialize | <add-in name>' context

(c) Sparx Systems 2018 Page 594 of 885

User Guide - Automation 26 July, 2018

menu optionAny defined Add-In windows are·

populated with information; select the'Specialize > Add-Ins > Windows'menu option

Disable anAdd-In

To disable an Add-In so that it is notavailable for use, clear the 'Load onStartup' checkbox corresponding to thename.Click on the OK button.All menu options, features and facilitiesspecific to the Add-In are hidden andmade inactive.

Notes

When you enable or disable an Add-In, you must re-start·

Enterprise Architect to action the change

(c) Sparx Systems 2018 Page 595 of 885

User Guide - Automation 26 July, 2018

Add-In Tasks

This topic provides instructions on how to create, test,deploy and manage Add-Ins.

Create an Add-In

Task

Create an Add-In.

Define Menu Items.

Respond to Menu Events.

Handle Add-In Events.

Deploy your Add-In

Task

Potential Pitfalls.

(c) Sparx Systems 2018 Page 596 of 885

User Guide - Automation 26 July, 2018

Manage Add-Ins

Task

Register an Add-In (developed in-house or brought-in).

The Add-In Manager.

(c) Sparx Systems 2018 Page 597 of 885

User Guide - Automation 26 July, 2018

Create Add-Ins

Before you start you must have an application developmenttool that is capable of creating ActiveX COM objectssupporting the IDispatch interface, such as:

Borland Delphi·

Microsoft Visual Basic·

Microsoft Visual Studio .NET·

You should consider how to define menu items. To helpwith this, you could review some examples of AutomationInterfaces - examples of code used to create Add-Ins forEnterprise Architect - on the Sparx Systems web page.

Create an Enterprise Architect Add-In

Step

Action

1 Use a development tool to create an ActiveX COMDLL project.Visual Basic users, for example, choose File-CreateNew Project-ActiveX DLL.

2 Connect to the interface using the syntax appropriateto the language.

(c) Sparx Systems 2018 Page 598 of 885

User Guide - Automation 26 July, 2018

3 Create a COM Class and implement each of thegeneral Add-In Events applicable to your Add-In.You only have to define methods for events torespond to.

4 Add a registry key that identifies your Add-In toEnterprise Architect, as described in the DeployAdd-Ins topic.

(c) Sparx Systems 2018 Page 599 of 885

User Guide - Automation 26 July, 2018

Define Menu Items

Tasks

Task Detail

Define MenuItems

Menu items are defined by responding tothe GetMenuItems event.The first time this event is called,MenuName is an empty string,representing the top-level menu. For asimple Add-In with just a single menuoption you can return a string. FunctionEA_GetMenuItems(Repository asEA.Repository, MenuLocation As String,MenuName As String) As Variant EA_GetMenuItems = "&Joe'sAdd-In" End Function

DefineSub-Menus

To define sub-menus, prefix a parentmenu with a dash. Parent and sub-itemsare defined like this:Function EA_GetMenuItems(Repositoryas EA.Repository, MenuLocation AsString, MenuName As String) As Variant

(c) Sparx Systems 2018 Page 600 of 885

User Guide - Automation 26 July, 2018

Select Case MenuName Case "" 'Parent Menu Item EA_GetMenuItems = "-&Joe'sAdd-In" Case "-&Joe's Add-In" 'Define Sub-Menu Items using theArray notation. 'In this example, "Diagram" and"Treeview" compose the "Joe's Add-In"sub-menu. EA_GetMenuItems =Array("&Diagram", "&Treeview") Case Else MsgBox "Invalid Menu",vbCritical End SelectEnd Function

DefineFurtherSub-Menus

Similarly, you can define furthersub-items:Function EA_GetMenuItems(Repositoryas EA.Repository, MenuLocation AsString, MenuName As String) As Variant Select Case MenuName Case "" EA_GetMenuItems = "-Joe's

(c) Sparx Systems 2018 Page 601 of 885

User Guide - Automation 26 July, 2018

Add-In" Case "-Joe's Add-In" EA_GetMenuItems =Array("-&Diagram", "&TreeView") Case "-&Diagram" EA_GetMenuItems ="&Properties" Case Else MsgBox "Invalid Menu",vbCritical End SelectEnd Function

Enable/Disable menuoptions

To enable or disable menu options bydefault, you can use this method to showparticular items to the user:Sub EA_GetMenuState(Repository AsEA.Repository, Location As String,MenuName As String, ItemName AsString, IsEnabled As Boolean, IsCheckedAs Boolean) Select Case Location Case "TreeView" 'Always enable Case "Diagram" 'Always enable Case "MainMenu"

(c) Sparx Systems 2018 Page 602 of 885

User Guide - Automation 26 July, 2018

Select Case ItemName Case "&Translate", "Save&Project" If GetIsProjectSelected() Then IsEnabled = False End If End Select End Select IsChecked = GetIsCurrentSelection()End Sub

(c) Sparx Systems 2018 Page 603 of 885

User Guide - Automation 26 July, 2018

Deploy Add-Ins

Deploy Add-Ins to users' sites

Step Action

1 Add the Add-In DLL file to anappropriate directory on the user'scomputer; that is: C:\Program Files\(new dir)

2 Register the DLL as appropriate to yourplatform:

If compiled as a native Win32 DDL,·

such as VB6 or C++, register the DDLusing the regsvr32 command from thecommand prompt regsvr32 "C:\ProgramFiles\MyCompany\EAAddin\EAAddin.dll"If compiled as a .NET DLL, such as C#·

or VB.NET, register the DLL using theRegAsm command from the commandprompt

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe "C:\Program

(c) Sparx Systems 2018 Page 604 of 885

User Guide - Automation 26 July, 2018

Files\MyCompany\EAAddin\EAAddin.dll" /codebase

3 Place a new entry into the registry usingthe registry editor (run regedit) so thatEnterprise Architect recognizes thepresence of your Add-In.

4 Add a new key 'EAAddIns' under one ofthese locations:

For the current user only·

[HKEY_CURRENT_USER\Software\Sparx Systems]For multiple users on a machine·

- Under 32-bit versions of Windows

[HKEY_LOCAL_MACHINE\Software\Sparx Systems] - Under 64-bit versions of Windows

[HKEY_LOCAL_MACHINE\Software\Wow6432Node\Sparx Systems]

5 Add a new key under this key with theproject name.

(c) Sparx Systems 2018 Page 605 of 885

User Guide - Automation 26 July, 2018

(ProjectName) is not necessarily thename of your DLL, but the name of theProject; in Visual Basic, this is the valuefor the property Name corresponding tothe project file.

6 Specify the default value by modifyingthe default value of the key.

7 Enter the value of the key by typing in the(project name).(class name), such as: EaRequirements.Requirementswhere EaRequirements is the projectname, as shown in this example:

(c) Sparx Systems 2018 Page 606 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 607 of 885

User Guide - Automation 26 July, 2018

Tricks and Traps

Considerations

Item Detail

Visual Basic5/6 UsersNote

Visual Basic 5/6 users should note thatthe version number of the EnterpriseArchitect interface is stored in the VBPproject file in a form similar to this:Reference=*\G{64FB2BF4-9EFA-11D2-8307-C45586000000}#2.2#0#..\..\..\..\Program Files\SparxSystems\EA\EA.TLB#EnterpriseArchitect Object Model 2.02If you experience problems moving fromone version of Enterprise Architect toanother, open the VBP file in a text editorand remove this line. Then open theproject in Visual Basic and useProject-References to create a newreference to the Enterprise ArchitectObject model.

Add-In Failsto Load

From Enterprise Architect release 7.0,Add-Ins created before 2004 are nolonger supported. If an Add-In subscribes

(c) Sparx Systems 2018 Page 608 of 885

User Guide - Automation 26 July, 2018

to the Addn_Tmpl.tlb interface (2003style), it fails on load. In this event,contact the vendor or author of theAdd-In and request an upgrade.

Holding StateInformation

It is possible for an Add-In to hold stateinformation, meaning that data can bestored in member variables in response toone event and retrieved in another. Thereare some dangers in doing this:

Enterprise Architect Automation·

Objects do not update themselves inresponse to user activity, to activity onother workstations, or even to theactions of other objects in the sameautomation client; retaining handles tosuch objects between calls can result inthe second event querying objects thathave no relationship with the currentstate of Enterprise ArchitectWhen you close Enterprise Architect,·

all Add-Ins are asked to shut down; ifthere are any external automationclients Enterprise Architect must stayactive, in which case all the Add-Insare reloaded, losing all the dataEnterprise Architect acting as an·

automation client does not close if anAdd-In still holds a reference to it

(c) Sparx Systems 2018 Page 609 of 885

User Guide - Automation 26 July, 2018

(releasing all references in theDisconnect() event avoids thisproblem)

It is recommended that unless there is aspecific reason for doing so, the Add-Inshould use the repository parameter andits method and properties to provide thenecessary data.

EnterpriseArchitect NotClosing

.NET Specific IssuesAutomation checks the use of objects andwill not allow any of them to bedestroyed until they are no longer beingused.As noted in the Automation Interfacetopic, if your automation controller waswritten using the .NET framework,Enterprise Architect does not close evenafter you release all your references to it.To force the release of the COM pointers,call the memory management functionsas shown: GC.Collect(); GC.WaitForPendingFinalizers();Additionally, because automation clientshook into Enterprise Architect, whichcreates Add-Ins that in turn hook backinto Enterprise Architect, it is possible toget into a deadlock situation where

(c) Sparx Systems 2018 Page 610 of 885

User Guide - Automation 26 July, 2018

Enterprise Architect and the Add-Ins willnot let go of one another and keep eachother active. An Add-In might retainhooks into Enterprise Architect because:

It keeps a private reference to an·

Enterprise Architect object (see theearlier Holding State Information), orIt has been created by .NET and the·

GC mechanism has not yet released itThere are two actions required to avoiddeadlock situations:

Automation controllers must call·

Repository.CloseAddins() at somepoint (perhaps at the end of processing)Add-Ins must release all references to·

Enterprise Architect in theDisconnect() event; see the Add-InEvents topic for details

It is possible that your Automation clientcontrols a running instance of EnterpriseArchitect where the Add-Ins have notcomplied with the rule above. In this caseyou could call Repository.Exit() toterminate Enterprise Architect.

MiscellaneousIn developing Add-Ins using the .NETframework you must select COM

(c) Sparx Systems 2018 Page 611 of 885

User Guide - Automation 26 July, 2018

Interoperability in the project's propertiesin order for it to be recognized as anAdd-In.Some development environments do notautomatically register COM DLLs oncreation. You might have to do thatmanually before Enterprise Architectrecognizes the Add-In.You can use your private Add-In key (asrequired for Add-In deployment) to storeconfiguration information pertinent toyour Add-In.

ConcurrentCalls

In Enterprise Architect releases up torelease 7.0, there is a possibility thatEnterprise Architect could call twoAdd-In methods concurrently if theAdd-In calls:

A message box·

A modal dialog·

VB DoEvents, .NET Application·

DoEvents or the equivalent in otherlanguages

In such cases, Enterprise Architect couldinitiate a second Add-In method beforethe first returns (re-entrancy). In release7.0. and subsequent releases, EnterpriseArchitect cannot make such concurrent

(c) Sparx Systems 2018 Page 612 of 885

User Guide - Automation 26 July, 2018

calls.If developing Add-Ins, ensure that theAdd-In users are running EnterpriseArchitect release 7.0 or a later release toavoid any risk of concurrent methodcalls.

(c) Sparx Systems 2018 Page 613 of 885

User Guide - Automation 26 July, 2018

Add-In Search

Enterprise Architect enables Extensions to integrate with theModel Search. Searches can be defined that execute amethod within your Add-In and display your results in anintegrated way.

The method that runs the search must be structured like this:

Function <method name> (ByVal Rep As Repository,ByVal SearchText As String, ByRef XMLResults AsString) As Variant

Rep - EA.Repository - IN - The current open repository·

SearchText - String - IN - An optional field that you can·

fill in through the Model Search

XMLResults - String - OUT - At completion of the·

method, this should contain the results for the search; theresults should be an XML string that conforms to theSearch Data Format

Return Value

The method must return any non-empty value for the resultsto be displayed.

Advanced Usage

(c) Sparx Systems 2018 Page 614 of 885

User Guide - Automation 26 July, 2018

In addition to the displayed results, two additional hiddenfields can be passed into the XML that provide specialfunctionality.

CLASSTYPE - Returning a field of CLASSTYPE,·

containing the Object_Type value from the t_object table,displays the appropriate icon in the column in which youplace the field

CLASSGUID - Returning a field of CLASSGUID,·

containing an ea_guid value, enables the Model Search totrack the object in the Project Browser and open theProperties window for the element by double-clicking inthe Model Search

(c) Sparx Systems 2018 Page 615 of 885

User Guide - Automation 26 July, 2018

XML Format (Search Data)

This example XML provides the format for the sSearchDataparameter of the RunModelSearch method.

<ReportViewData UID=\"MySearchID\">

<!--

//The UID attribute enables XML type searches topersist column information. That is, if you run the search,group by column or adjust

//column widths, then close the window and run thesearch again, the format/organization changes are retained.To avoid persisting column

//arrangements, leave the attribute value blank orremove it altogether. Use this section to declare all possiblefields - columns that appear

//in Enterprise Architect's Search window - that areused below in <Rows/>. The order of the columns ofinformation to be appended here must

//match the order that the search run in EnterpriseArchitect would normally display. Furthermore, if youappend results onto a custom SQL

//Search, then the order used in your Custom SQLmust match the order used here.

-->

<Fields>

<Field name=""/>

(c) Sparx Systems 2018 Page 616 of 885

User Guide - Automation 26 July, 2018

<Field name=""/>

<Field name=""/>

<Field name=""/>

</Fields>

<Rows>

<Row>

<Field name="" value=""/>

<Field name="" value=""/>

<Field name="" value=""/>

<Field name="" value=""/>

</Row>

<Row>

<Field name="" value=""/>

<Field name="" value=""/>

<Field name="" value=""/>

<Field name="" value=""/>

</Row>

<Row>

<Field name="" value=""/>

<Field name="" value=""/>

<Field name="" value=""/>

<Field name="" value=""/>

</Row>

</Rows>

</ReportViewData>

(c) Sparx Systems 2018 Page 617 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 618 of 885

User Guide - Automation 26 July, 2018

Add-In Events

All Enterprise Architect Add-Ins can choose to respond togeneral Add-In events.

Events

Event

EA_Connect - Add-Ins can use this to identify their typeand to respond to Enterprise Architect start up.

EA_Disconnect - Add-Ins can use this to respond to userrequests to disconnect the model branch from an externalproject.

EA_GetMenuItems - Add-Ins can use this to provide theEnterprise Architect user interface with additional Add-Inmenu options in various context menus.

EA_GetMenuState - Add-Ins can use this to set aparticular menu option to either enabled or disabled.

EA_GetRibbonCategory - Add-Ins can use this to identifythe Ribbon panel in which to house their calling icon.

EA_MenuClick - received by an Add-In in response to

(c) Sparx Systems 2018 Page 619 of 885

User Guide - Automation 26 July, 2018

user selection of a menu option.

EA_OnOutputItemClicked - informs Add-Ins that theuser has clicked on a list entry in the system tab or one ofthe user defined output tabs.

EA_OnOutputItemDoubleClicked - informs Add-Ins thatthe user has used the mouse to double-click on a list entryin one of the user-defined output tabs.

EA_ShowHelp - Add-Ins can use this to show a Helptopic for a particular menu option.

(c) Sparx Systems 2018 Page 620 of 885

User Guide - Automation 26 July, 2018

EA_Connect

Add-Ins can use EA_Connect events to identify their typeand to respond to Enterprise Architect start up.

This event occurs when Enterprise Architect first loads yourAdd-In. Enterprise Architect itself is loading at this time sothat while a Repository object is supplied, there is limitedinformation that you can extract from it.

The chief uses for EA_Connect are in initializing globalAdd-In data and for identifying the Add-In as an MDGAdd-In.

Syntax

Function EA_Connect (Repository As EA.Repository) AsString

The EA_Connect function syntax has this parameter:

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 621 of 885

User Guide - Automation 26 July, 2018

Return Value

A string identifying a specialized type of Add-In:

Type Details

"MDG" MDG Add-Ins receive MDG Events andextra menu options.

"" A non-specialized Add-In.

(c) Sparx Systems 2018 Page 622 of 885

User Guide - Automation 26 July, 2018

EA_Disconnect

Add-Ins can use the EA_Disconnect event to respond touser requests to disconnect the model branch from anexternal project.

This function is called when Enterprise Architect closes. Ifyou have stored references to Enterprise Architect objects(not particularly recommended anyway), you must releasethem here.

In addition, .NET users must call memory managementfunctions as shown:

GC.Collect();

GC.WaitForPendingFinalizers();

Syntax

Sub EA_Disconnect()

Return Value

None.

(c) Sparx Systems 2018 Page 623 of 885

User Guide - Automation 26 July, 2018

EA_GetMenuItems

The EA_GetMenuItems event enables the Add-In to providethe Enterprise Architect user interface with additionalAdd-In menu options in various context menus. When a userselects an Add-In menu option, an event is raised and passedback to the Add-In that originally defined that menu option.

This event is raised just before Enterprise Architect has toshow particular menu options to the user, and its use isdescribed in the Define Menu Items topic.

Syntax

Function EA_GetMenuItems (Repository AsEA.Repository, MenuLocation As String, MenuName AsString) As Variant

The EA_GetMenuItems function syntax has theseparameters.

Parameter Type

MenuLocation

StringDirection: INDescription: A string representing thepart of the user interface that brought upthe menu. This can be TreeView,MainMenu or Diagram.

(c) Sparx Systems 2018 Page 624 of 885

User Guide - Automation 26 July, 2018

MenuName StringDirection: INDescription: The name of the parentmenu for which sub-items are to bedefined. In the case of the top-level menuthis is an empty string.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

One of these types:

A string indicating the label for a single menu option·

An array of strings indicating a multiple menu options·

Empty (Visual Basic/VB.NET) or null (C#) to indicate·

that no menu should be displayed

In the case of the top-level menu it should be a single stringor an array containing only one item, or empty/null.

(c) Sparx Systems 2018 Page 625 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 626 of 885

User Guide - Automation 26 July, 2018

EA_GetMenuState

Add-Ins can use the EA_GetMenuState event to set aparticular menu option to either enabled or disabled. This isuseful when dealing with locked Packages and othersituations where it is convenient to show a menu option, butnot enable it for use.

This event is raised just before Enterprise Architect has toshow particular menu options to the user. Its use is furtherdescribed in the Define Menu Items topic.

Syntax

Sub EA_GetMenuState (Repository as EA.Repository,MenuLocation As String, MenuName as String, ItemNameas String, IsEnabled as Boolean, IsChecked as Boolean)

The EA_GetMenuState function syntax has theseparameters.

Parameter Type

IsChecked BooleanDirection: OUTDescription: Set to True to check thisparticular menu option.

IsEnabled Boolean

(c) Sparx Systems 2018 Page 627 of 885

User Guide - Automation 26 July, 2018

Direction: OUTDescription: Set to False to disable thisparticular menu option.

ItemName StringDirection: INDescription: The name of the optionactually clicked; for example, 'Create aNew Invoice'.

MenuLocation

StringDirection: INDescription: A string representing thepart of the user interface that brought upthe menu. This can be TreeView,MainMenu or Diagram.

MenuName StringDirection: INDescription: The name of the parentmenu for which sub-items must bedefined. In the case of the top-level menuit is an empty string.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open Enterprise

(c) Sparx Systems 2018 Page 628 of 885

User Guide - Automation 26 July, 2018

Architect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

None.

(c) Sparx Systems 2018 Page 629 of 885

User Guide - Automation 26 July, 2018

EA_GetRibbonCategory

Add-Ins can use EA_GetRibbonCategory events to identifythe Ribbon in which the Add-In should place its menu icon.

This event occurs when Enterprise Architect first loads yourAdd-In. Enterprise Architect itself is loading at this time sothat while a Repository object is supplied, there is limitedinformation that you can extract from it.

The chief use for EA_GetRibbonCategory is in initializingthe Add-In access point.

Syntax

Function EA_GetRibbonCategory (Repository AsEA.Repository) As String

The EA_GetRibbonCategory function syntax has thisparameter:

Parameter Description

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 630 of 885

User Guide - Automation 26 July, 2018

Return Value

A string matching the name of the selected ribbon (inEnglish if you are using a translated version). The possiblenames are:

Start·

Design·

Layout·

Publish·

Specialize·

Construct·

Code·

Simulate·

Execute·

Manage·

It is not possible to include Add-Ins in the 'Specification -Specify' ribbon or 'Documentation - Edit' ribbon.

If the function isn't implemented (or if an invalid name isreturned) the 'Add-In' menu will be available from the'Specialize' ribbon, 'Add-Ins' panel.

(c) Sparx Systems 2018 Page 631 of 885

User Guide - Automation 26 July, 2018

EA_MenuClick

EA_MenuClick events are received by an Add-In inresponse to user selection of a menu option.

The event is raised when the user clicks on a particularmenu option. When a user clicks on one of your non-parentmenu options, your Add-In receives a MenuClick event,defined as:

Sub EA_MenuClick(Repository As EA.Repository,ByVal MenuLocation As String, ByVal MenuName AsString, ByVal ItemName As String)

This code is an example of use:

If MenuName = "-&Diagram" And ItemName ="&Properties" then

MsgBox Repository.GetCurrentDiagram.Name,vbInformation

Else

MsgBox "Not Implemented", vbCritical

End If

Notice that your code can directly access EnterpriseArchitect data and UI elements using Repository methods.

Syntax

Sub EA_MenuClick (Repository As EA.Repository,MenuLocation As String, MenuName As String, ItemName

(c) Sparx Systems 2018 Page 632 of 885

User Guide - Automation 26 July, 2018

As String)

The EA_GetMenuClick function syntax has theseparameters.

Parameter Type

ItemName StringDirection: INDescription: The name of the optionactually clicked; for example, 'Create aNew Invoice'.

MenuLocation

StringDirection: INDescription: A string representing thepart of the user interface that brought upthe menu. This can be TreeView,MainMenu or Diagram.

MenuName StringDirection: INDescription: The name of the parentmenu for which sub-items are to bedefined. In the case of the top-level menuthis is an empty string.

Repository EA.RepositoryDirection: IN

(c) Sparx Systems 2018 Page 633 of 885

User Guide - Automation 26 July, 2018

Description: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

None.

(c) Sparx Systems 2018 Page 634 of 885

User Guide - Automation 26 July, 2018

EA_OnOutputItemClicked

EA_OnOutputItemClicked events inform Add-Ins that theuser has clicked on a list entry in the system tab or one ofthe user defined output tabs.

Usually an Add-In responds to this event in order to captureactivity on an output tab they had previously createdthrough a call to Repository.AddTab().

Note that every loaded Add-In receives this event for everyclick on an output tab in Enterprise Architect, irrespective ofwhether the Add-In created that tab. Add-Ins shouldtherefore check the TabName parameter supplied by thisevent to ensure that they are not responding to otherAdd-Ins' events.

Syntax

EA_OnOutputItemClicked (Repository As EA.Repository,TabName As String, LineText As String, ID As Long)

The EA_OnOutputItemClicked function syntax has theseparameters.

Parameter Type

ID LongDirection: INDescription: The ID value specified in the

(c) Sparx Systems 2018 Page 635 of 885

User Guide - Automation 26 July, 2018

original call to Repository.WriteOutput().

LineText StringDirection: INDescription: The text that had beensupplied as the String parameter in theoriginal call to'Repository.WriteOutput()'.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

TabName StringDirection: INDescription: The name of the tab that theclick occurred in. Usually this wouldhave been created through'Repository.AddTab()'.

Return Value

(c) Sparx Systems 2018 Page 636 of 885

User Guide - Automation 26 July, 2018

None.

(c) Sparx Systems 2018 Page 637 of 885

User Guide - Automation 26 July, 2018

EA_OnOutputItemDoubleClicked

EA_OnOutputItemDoubleClicked events inform Add-Insthat the user has used the mouse to double-click on a listentry in one of the user-defined output tabs.

Usually an Add-In responds to this event in order to captureactivity on an output tab they had previously createdthrough a call to Repository.AddTab().

Note that every loaded Add-In receives this event for everydouble-click on an output tab in Enterprise Architect,irrespective of whether the Add-In created that tab; Add-Insshould therefore check the TabName parameter supplied bythis event to ensure that they are not responding to otherAdd-Ins' events.

Syntax

EA_OnOutputItemDoubleClicked (Repository AsEA.Repository, TabName As String, LineText As String, IDAs Long)

The EA_OnOutputItemClicked function syntax containsthese parameters.

Parameter Type

ID LongDirection: INDescription: The ID value specified in the

(c) Sparx Systems 2018 Page 638 of 885

User Guide - Automation 26 July, 2018

original call to Repository.WriteOutput().

LineText StringDirection: INDescription: The text that had beensupplied as the String parameter in theoriginal call to'Repository.WriteOutput()'.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model; poll its members toretrieve model data and user interfacestatus information.

TabName StringDirection: INDescription: The name of the tab that theclick occurred in; usually this would havebeen created through'Repository.AddTab()'.

Return Value

(c) Sparx Systems 2018 Page 639 of 885

User Guide - Automation 26 July, 2018

None.

(c) Sparx Systems 2018 Page 640 of 885

User Guide - Automation 26 July, 2018

EA_ShowHelp

Add-Ins can use the EA_ShowHelp event to show a Helptopic for a particular menu option. When the user has anAdd-In menu option selected, pressing F1 can be related tothe required Help topic by the Add-In and a suitable helpmessage shown.

This event is raised when the user presses F1 on a menuoption that is not a parent menu.

Syntax

Sub EA_ShowHelp (Repository as EA.Repository,MenuLocation As String, MenuName as String, ItemNameas String)

The EA_ShowHelp function syntax contains theseparameters.

Parameter Type

ItemName StringDirection:Description: The name of the optionactually clicked; for example, 'Create aNew Invoice'.

MenuLocation

String

(c) Sparx Systems 2018 Page 641 of 885

User Guide - Automation 26 July, 2018

Direction:Description: A string representing thepart of the user interface that brought upthe menu. This can be Treeview,MainMenu or Diagram.

MenuName StringDirection:Description: The name of the parentmenu for which sub-items are to bedefined. In the case of the top-level menuthis is an empty string.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

None.

(c) Sparx Systems 2018 Page 642 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 643 of 885

User Guide - Automation 26 July, 2018

Broadcast Events

Overview

Broadcast events are sent to all loaded Add-Ins. For anAdd-In to receive the event, they must first implement therequired automation event interface. If Enterprise Architectdetects that the Add-In has the required interface, the eventis dispatched to the Add-In.

MDG Events add a number of additional events, but theAdd-In must first have registered as an MDG-style Add-In,rather than as a generic Add-In.

Event Type

Add-In Licence Management Events

Compartment Events

Context Item Events

File Close Event

File New Event

File Open Event

Model Validation Broadcasts

(c) Sparx Systems 2018 Page 644 of 885

User Guide - Automation 26 July, 2018

On Tab Changed Event

Post Close Diagram Event

Post Initialization Event

Post New Events

Post Open Diagram Event

Pre-Deletion Events

Pre-Exit Instance (not currently used)

On the creation of new objects

Retrieve Model Template Event

Schema Composer Broadcasts

Tagged Value Broadcasts

Technology Events

Transformation Event

(c) Sparx Systems 2018 Page 645 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 646 of 885

User Guide - Automation 26 July, 2018

Schema Composer Broadcasts

Enterprise Architect Add-Ins can respond to eventsassociated with the Schema Composer to provide customschema export formats.

The requirements for an Add-In to participate consist ofimplementing these three functions:

EA_IsSchemaExporter·

EA_GetProfileInfo·

EA_GenerateFromSchema·

(c) Sparx Systems 2018 Page 647 of 885

User Guide - Automation 26 July, 2018

EA_GenerateFromSchema

Respond to a 'Generate' request from the Schema Composerwhen using the profile type specified by theEA_IsSchemaExporter event. The SchemaComposer objectcan be used to traverse the schema. Export formats that havebeen requested by the user for generation will be listed inthe exports parameter.

Syntax

Sub EA_GenerateFromSchema (Repository asEA.Repository, composer as EA.SchemaComposer, exportsas String)

Parameter Details

Repository Type: EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open model.Poll its members to retrieve model dataand user interface status information.

composer Type: EA.SchemaComposerDirection: INDescription: Provides access to the typesdefined in the schema currently being

(c) Sparx Systems 2018 Page 648 of 885

User Guide - Automation 26 July, 2018

generated. Use the SchemaTypes attributeto enumerate through the types andoutput to the appropriate export format.

exports Type: StringDirection: INDescription: Comma-separated list ofexport formats that the user has requestedin the 'Generate' dialog.

Return Value

None.

(c) Sparx Systems 2018 Page 649 of 885

User Guide - Automation 26 July, 2018

EA_GetProfileInfo

Add-ins can optionally implement this function to define thecapabilities of the Schema Composer when working withthe profile type specified by the EA_IsSchemaExporterevent.

Syntax

Sub EA_GetProfileInfo (Repository as EA.Repository,profile as EA.SchemaProfile)

Parameter Details

Repository Type: EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open model.Poll its members to retrieve model dataand user interface status information.

profile Type: EA.SchemaProfileDirection: INDescription: An EA.SchemaProfile objectrepresenting the currently active profiletype. Call the SetCapability function toenable or disable various capabilities ofthe Schema Composer. Call the

(c) Sparx Systems 2018 Page 650 of 885

User Guide - Automation 26 July, 2018

AddExportFormat function to defineadditional export formats that this profilewill support.

Return Value

None.

(c) Sparx Systems 2018 Page 651 of 885

User Guide - Automation 26 July, 2018

EA_IsSchemaExporter

Enterprise Architect Add-Ins can integrate with the SchemaComposer by providing alternatives to offer users for thegeneration of schemas and sub models.

The Add-in must implement this function to be listed in theSchema Composer.

Syntax

Function EA_IsSchemaExporter(Repository asEA.Repository, ByRef displayName as String) As Boolean

Parameter Details

Repository Type: EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open model.Poll its members to retrieve model dataand user interface status information.

displayName Type: StringDirection: OUTDescription: The name of the customschema set that will be provided by thisAdd-In.

(c) Sparx Systems 2018 Page 652 of 885

User Guide - Automation 26 July, 2018

Return Value

Return True to indicate that this Add-In will provide schemaexport functionality and be listed as a Schema Set whendefining a new profile in the Schema Composer.

(c) Sparx Systems 2018 Page 653 of 885

User Guide - Automation 26 July, 2018

Add-In License Management Events

Enterprise Architect Add-Ins can respond to eventsassociated with Add-In License Management.

License Management Events

Event

EA_AddinLicenseValidate

EA_AddinLicenseGetDescription

EA_GetSharedAddinName

(c) Sparx Systems 2018 Page 654 of 885

User Guide - Automation 26 July, 2018

EA_AddinLicenseValidate

When a user directly enters into the 'License Management'dialog a license key that doesn't match a Sparx Systems key,EA_AddInLicenseValidate is broadcast to all EnterpriseArchitect Add-Ins, providing them with a chance to use theAdd-In key to determine the level of functionality toprovide. When a key is retrieved from the Sparx SystemsKeystore only the target Add-In will be called with the key.

For the Add-In to validate itself against this key, theAdd-In's EA_AddinLicenseValidate handler should returnconfirmation that the license has been validated. As theEA_AddinLicenseValidate event is broadcast to all Add-Ins,one license can validate many Add-Ins.

If an Add-In elects to handle a license key by returning aconfirmation to EA_AddinLicenseValidate, it is called uponto provide a description of the license key through theEA_AddinLicenseGetDescription event. If more than oneAdd-In elects to handle a license key, the first Add-In thatreturns a confirmation to EA_AddinLicenseValidate isqueried for the license key description.

Syntax

Function EA_AddInLicenseValidate (Repository AsEA.Repository, AddinKey As String) As Boolean

Parameter Type

(c) Sparx Systems 2018 Page 655 of 885

User Guide - Automation 26 July, 2018

AddinKey StringDirection: INDescription: The Add-in license key thathas been entered in the 'LicenseManagement' dialog.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Returns True if the license key is validated for the currentAdd-In. Returns False otherwise.

(c) Sparx Systems 2018 Page 656 of 885

User Guide - Automation 26 July, 2018

EA_AddinLicenseGetDescription

Before the Enterprise Architect 'License Management'dialog is displayed, EA_AddInLicenseGetDescription issent once for each Add-In key to the first Add-In thatelected to handle that key.

The value returned by EA_AddinLicenseGetDescription isused as the key's plain text description.

Syntax

Function EA_AddinLicenseGetDescription (Repository asEA.Repository, AddinKey as String) As String

Parameter Type

AddinKey StringDirection: INDescription: The Add-In license key thatEnterprise Architect requires adescription for.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open model.Poll its members to retrieve model data

(c) Sparx Systems 2018 Page 657 of 885

User Guide - Automation 26 July, 2018

and user interface status information.

Return Value

A String containing a plain text description of the providedAddinKey.

(c) Sparx Systems 2018 Page 658 of 885

User Guide - Automation 26 July, 2018

EA_GetSharedAddinName

As an Add-In writer you can distribute keys to your Add-Invia the Enterprise Architect Keystore, provided that yourkeys are added using a prefix that allows the system toidentify the Add-In to which they belong.EA_GetSharedAddinName is called to determine whatprefix the Add-In is using. If a matching key is found in thekeystore the 'License Management' dialog will display thename returned by EA_AddinLicenseGetDescription to yourusers. Finally, when the user selects a key, that key will bepassed to your Add-In to validate by callingEA_AddinLicenseValidate.

Syntax

Function EA_GetSharedAddinName (Repository asEA.Repository) As String

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open model.Poll its members to retrieve model dataand user interface status information.

(c) Sparx Systems 2018 Page 659 of 885

User Guide - Automation 26 July, 2018

Return Value

A String containing a product name code for the providedAdd-In, such as MYADDIN. This will be shown in plaintext in any keys added to the keystore.

Notes

Shared Add-In keys have the format:

EASK-YOURCODE-REALKEY

EASK - Constant string that identifies a shared key for an·

Enterprise Architect Add-In

YOURCODE - The code you select and verify with us:·

- Displayed to the administrator of the keystore - Recommended length of 6-10 characters - Contains ASCII characters 33-126, except for '-' (45)

REALKEY - Encoding of the actual key or checksums·

- Recommended length of 8-32 characters - Contains ASCII characters 33-126

We recommend that you contact Sparx Systems directlywith proposed values to ensure that you don't clash with anyother Add-Ins.

For example, these keys would all be interpreted asbelonging to an Add-In returning MYADDIN from this

(c) Sparx Systems 2018 Page 660 of 885

User Guide - Automation 26 July, 2018

function:

EASK-MYADDIN-Test·

EASK-MYADDIN-{7AC4D426-9083-4fa2-93B7-25E2B·

7FB8DC5}

EASK-MYADDIN-7AC4D426-9083-4fa2-93B7·

EASK-MYADDIN-25E2B7FB8DC5·

EASK-MYADDIN-2hDfHKA5jf0GAjn92UvqAnxwC13·

dxQGJtH7zLHJ9Ym8=

(c) Sparx Systems 2018 Page 661 of 885

User Guide - Automation 26 July, 2018

Compartment Events

Enterprise Architect Add-Ins can respond to various eventsassociated with user-generated element compartments.

Compartment Broadcast Events

Event

EA_QueryAvailableCompartments

EA_GetCompartmentData

(c) Sparx Systems 2018 Page 662 of 885

User Guide - Automation 26 July, 2018

EA_QueryAvailableCompartments

This event occurs when Enterprise Architect's diagrams arerefreshed. It is a request for the Add-In to provide a list ofuser-defined compartments.

The EA_GetCompartmentData event then queries eachobject for the data to display in each user-definedcompartment.

Syntax

Function EA_QueryAvailableCompartments (Repository AsEA.Repository) As Variant

The EA_QueryAvailableCompartments function syntaxcontains this parameter.

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 663 of 885

User Guide - Automation 26 July, 2018

Return Value

A String containing a comma-separated list of user-definedcompartments.

Example

Function EA_QueryAvailableCompartments(Repository AsEA.Repository) As Variant

Dim sReturn As String

sReturn = ""

If m_FirstCompartmentVisible = True Then

sReturn = sReturn + "first,"

End If

If m_SecondCompartmentVisible = True Then

sReturn = sReturn + "second,"

End If

If m_ThirdCompartmentVisible = True Then

sReturn = sReturn + "third,"

End If

If Len(sReturn) > 0 Then

sReturn = Left(sReturn, Len(sReturn)-1)

End If

(c) Sparx Systems 2018 Page 664 of 885

User Guide - Automation 26 July, 2018

EA_QueryAvailableCompartments = sReturn

End Function

(c) Sparx Systems 2018 Page 665 of 885

User Guide - Automation 26 July, 2018

EA_GetCompartmentData

This event occurs when Enterprise Architect is instructed toredraw an element. It requests that the Add-In provide thedata to populate the element's compartment.

Syntax

Function EA_GetCompartmentData (Repository AsEA.Repository, sCompartment As String, sGUID As String,oType As EA.ObjectType) As Variant

The EA_QueryAvailableCompartments function syntaxcontains these parameters.

Parameter Type

oType ObjectTypeDirection: INDescription: The type of the element forwhich data is being requested.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interface

(c) Sparx Systems 2018 Page 666 of 885

User Guide - Automation 26 July, 2018

status information.

sCompartment

StringDirection: INDescription: The name of thecompartment for which data is beingrequested.

sGUID StringDirection: INDescription: The GUID of the elementfor which data is being requested.

Return Value

A variant containing a formatted string. The format isillustrated in this example:

Example

Function EA_GetCompartmentData(Repository AsEA.Repository, sCompartment As String, sGUID As String,oType As EA.ObjectType) As Variant

(c) Sparx Systems 2018 Page 667 of 885

User Guide - Automation 26 July, 2018

If Repository Is Nothing Then

Exit Function

End If

Dim sCompartmentData As String

Dim oXML As MSXML2.DOMDocument

Dim Nodes As MSXML2.IXMLDOMNodeList

Dim Node1 As MSXML2.IXMLDOMNode

Dim Node As MSXML2.IXMLDOMNode

Dim sData As String

sCompartmentData = ""

Set oXML = New MSXML2.DOMDocument

sData = ""

On Error GoTo ERR_GetCompartmentData

oXML.loadXML(Repository.GetTreeXMLByGUID(sGUID))

Set Node1 = oXML.selectSingleNode("//ModelItem")

If Node1 Is Nothing Then

Exit Function

End If

sCompartmentData = sCompartmentData + "Name=" +sCompartment + ";"

sCompartmentData = sCompartmentData +

(c) Sparx Systems 2018 Page 668 of 885

User Guide - Automation 26 July, 2018

"OwnerGUID=" + sGUID + ";"

sCompartmentData = sCompartmentData +"Options=SkipIfOnDiagram&_eq_^1&_sc_^"

Select Case sCompartment

Case "parts"

Set Nodes =Node1.selectNodes("ModelItem(@Metatype=""Part"")")

For Each Node In Nodes

sData = sData + "Data&_eq_^" +Node.Attributes.getNamedItem("Name").nodeValue +"&_sc_^"

sData = sData + "GUID&_eq_^" +Node.Attributes.getNamedItem("GUID").nodeValue +"&_sc_^,"

Next

Case "ports"

Set Nodes =Node1.selectNodes("ModelItem(@Metatype=""Port"")")

For Each Node In Nodes

sData = sData + "Data&_eq_^" +Node.Attributes.getNamedItem("Name").nodeValue +"&_sc_^"

sData = sData + "GUID&_eq_^" +Node.Attributes.getNamedItem("GUID").nodeValue +"&_sc_^,"

Next

End Select

(c) Sparx Systems 2018 Page 669 of 885

User Guide - Automation 26 July, 2018

If there is no data to display, then don't return anycompartment data

If sData <> "" Then

sCompartmentData = sCompartmentData +"CompartmentData=" + sData + ";"

Else

sCompartmentData = ""

End If

EA_GetCompartmentData = sCompartmentData

Exit Function

ERR_GetCompartmentData:

EA_GetCompartmentData = ""

End Function

(c) Sparx Systems 2018 Page 670 of 885

User Guide - Automation 26 July, 2018

Context Item Events

Enterprise Architect Add-Ins can respond to eventsassociated with changing context.

Context Item Broadcast Events

Event

EA_OnContextItemChanged

EA_OnContextItemDoubleClicked

EA_OnNotifyContextItemModified

(c) Sparx Systems 2018 Page 671 of 885

User Guide - Automation 26 July, 2018

EA_OnContextItemChanged

EA_OnContextItemChanged notifies Add-Ins that adifferent item is now in context.

This event occurs after a user has selected an item anywherein the Enterprise Architect GUI. Add-Ins that requireknowledge of the current item in context can subscribe tothis broadcast function. If ot = otRepository, then thisfunction behaves in the same way as EA_FileOpen.

Syntax

Sub EA_OnContextItemChanged (Repository AsEA.Repository, GUID As String, ot as EA.ObjectType)

The EA_OnContextItemChanged function syntax containsthese parameters.

Parameter Type

GUID StringDirection: INDescription: Contains the GUID of thenew context item. The value correspondsto these properties, depending on thevalue of the ot parameter:

ot (ObjectType) - GUID value·

otElement - Element.ElementGUID·

(c) Sparx Systems 2018 Page 672 of 885

User Guide - Automation 26 July, 2018

otPackage - Package.PackageGUID·

otDiagram - Diagram.DiagramGUID·

otAttribute - Attribute.AttributeGUID·

otMethod - Method.MethodGUID·

otConnector -·

Connector.ConnectorGUIDotRepository - NOT APPLICABLE,·

the GUID is an empty string

ot EA.ObjectTypeDirection: INDescription: Specifies the type of the newcontext item.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

None.

(c) Sparx Systems 2018 Page 673 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 674 of 885

User Guide - Automation 26 July, 2018

EA_OnContextItemDoubleClicked

EA_OnContextItemDoubleClicked notifies Add-Ins that theuser has double-clicked the item currently in context.

This event occurs when a user has double-clicked (orpressed the Enter key) on the item in context, either in adiagram, in the Project Browser or in a customcompartment. Add-Ins to handle events can subscribe to thisbroadcast function.

Syntax

Function EA_OnContextItemDoubleClicked (Repository AsEA.Repository, GUID As String, ot as EA.ObjectType)

The EA_OnContextItemDoubleClicked function syntaxcontains these parameters.

Parameter Type

GUID StringDirection: INDescription: Contains the GUID of thenew context item. The value correspondsto these properties, depending on thevalue of the ot parameter:

otElement - Element.ElementGUID·

otPackage - Package.PackageGUID·

(c) Sparx Systems 2018 Page 675 of 885

User Guide - Automation 26 July, 2018

otDiagram - Diagram.DiagramGUID·

otAttribute - Attribute.AttributeGUID·

otMethod - Method.MethodGUID·

otConnector -·

Connector.ConnectorGUID

ot EA.ObjectTypeDirection: INDescription: Specifies the type of the newcontext item.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to notify Enterprise Architect that thedouble-click event has been handled by an Add-In.

Return False to enable Enterprise Architect to continueprocessing the event.

(c) Sparx Systems 2018 Page 676 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 677 of 885

User Guide - Automation 26 July, 2018

EA_OnNotifyContextItemModified

EA_OnNotifyContextItemModified notifies Add-Ins thatthe current context item has been modified.

This event occurs when a user has modified the contextitem. Add-Ins that require knowledge of when an item hasbeen modified can subscribe to this broadcast function.

Syntax

Sub EA_OnNotifyContextItemModified (Repository AsEA.Repository, GUID As String, ot as EA.ObjectType)

The EA_OnNotifyContextItemModified function syntaxcontains these parameters.

Parameter Type

GUID StringDirection: INDescription: Contains the GUID of thenew context item. The value correspondsto these properties, depending on thevalue of the ot parameter:

ot(ObjectType) - GUID value·

otElement - Element.ElementGUID·

otPackage - Package.PackageGUID·

otDiagram - Diagram.DiagramGUID·

(c) Sparx Systems 2018 Page 678 of 885

User Guide - Automation 26 July, 2018

otAttribute - Attribute.AttributeGUID·

otMethod - Method.MethodGUID·

otConnector -·

Connector.ConnectorGUID

ot EA.ObjectTypeDirection: INDescription: Specifies the type of the newcontext item.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

None.

(c) Sparx Systems 2018 Page 679 of 885

User Guide - Automation 26 July, 2018

EA_FileClose

The EA_FileClose event enables the Add-In to respond to aFile Close event. When Enterprise Architect closes anopened Model file, this event is raised and passed to allAdd-Ins implementing this method.

This event occurs when the model currently opened withinEnterprise Architect is about to be closed (when anothermodel is about to be opened or when Enterprise Architect isabout to shutdown).

Syntax

Sub EA_FileClose (Repository As EA.Repository)

The EA_FileClose function syntax contains this parameter:

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the Enterprise Architectmodel about to be closed. Poll itsmembers to retrieve model data and userinterface status information.

(c) Sparx Systems 2018 Page 680 of 885

User Guide - Automation 26 July, 2018

Return Value

None.

(c) Sparx Systems 2018 Page 681 of 885

User Guide - Automation 26 July, 2018

EA_FileNew

The EA_FileNew event enables the Add-In to respond to aFile New event. When Enterprise Architect creates a newmodel file, this event is raised and passed to all Add-Insimplementing this method.

The event occurs when the model being viewed by theEnterprise Architect user changes, for whatever reason(through user interaction or Add-In activity).

Syntax

Sub EA_FileNew (Repository As EA.Repository)

The EA_FileNew function syntax contains this parameter.

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 682 of 885

User Guide - Automation 26 July, 2018

Return Value

None.

(c) Sparx Systems 2018 Page 683 of 885

User Guide - Automation 26 July, 2018

EA_FileOpen

The EA_FileOpen event enables the Add-In to respond to aFile Open event. When Enterprise Architect opens a newmodel file, this event is raised and passed to all Add-Insimplementing this method.

The event occurs when the model being viewed by theEnterprise Architect user changes, for whatever reason(through user interaction or Add-In activity).

Syntax

Sub EA_FileOpen (Repository As EA.Repository)

The EA_FileOpen function syntax contains this parameter.

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 684 of 885

User Guide - Automation 26 July, 2018

Return Value

None.

(c) Sparx Systems 2018 Page 685 of 885

User Guide - Automation 26 July, 2018

EA_OnPostCloseDiagram

EA_OnPostCloseDiagram notifies Add-Ins that a diagramhas been closed.

Syntax

Function EA_OnPostCloseDiagram (Repository AsEA.Repository, DiagramID As Integer)

The EA_OnPostCloseDiagram function syntax containsthese parameters.

Parameter Type

DiagramID IntegerDirection: INDescription: Contains the Diagram ID ofthe diagram that was closed.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the Enterprise Architectmodel about to be closed. Poll itsmembers to retrieve model data and userinterface status information.

(c) Sparx Systems 2018 Page 686 of 885

User Guide - Automation 26 July, 2018

Return Value

None.

(c) Sparx Systems 2018 Page 687 of 885

User Guide - Automation 26 July, 2018

EA_OnPostInitialized

EA_OnPostInitialized notifies Add-Ins that the Repositoryobject has finished loading and any necessary initializationsteps can now be performed on the object.

For example, the Add-In can create an 'Output' tab usingRepository.CreateOutputTab.

Syntax

Sub EA_OnPostInitialized (Repository As EA.Repository)

The EA_OnPostInitialized function syntax contains thisparameter.

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

(c) Sparx Systems 2018 Page 688 of 885

User Guide - Automation 26 July, 2018

None.

(c) Sparx Systems 2018 Page 689 of 885

User Guide - Automation 26 July, 2018

EA_OnPostOpenDiagram

EA_OnPostOpenDiagram notifies Add-Ins that a diagramhas been opened.

Syntax

Function EA_OnPostOpenDiagram (Repository AsEA.Repository, DiagramID As Integer)

The EA_OnPostOpenDiagram function syntax containsthese parameters.

Parameter Type

DiagramID IntegerDirection: INDescription: Contains the Diagram ID ofthe diagram that was opened.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 690 of 885

User Guide - Automation 26 July, 2018

Return Value

None.

(c) Sparx Systems 2018 Page 691 of 885

User Guide - Automation 26 July, 2018

EA_OnPostTransform

EA_OnPostTransform notifies Add-Ins that an MDGtransformation has taken place with the output in thespecified target Package.

This event occurs when a user runs an MDG transform onone or more target Packages; the notification is provided foreach transform/target Package immediately after alltransform processes have completed.

Syntax

Function EA_OnPostTransform (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPostTransform function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty Objects for the transformperformed:

Transform: A string value·

corresponding to the name of thetransform used

(c) Sparx Systems 2018 Page 692 of 885

User Guide - Automation 26 July, 2018

PackageID: A long value·

corresponding to Package.PackageIDof the destination Package

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Reserved for future use.

(c) Sparx Systems 2018 Page 693 of 885

User Guide - Automation 26 July, 2018

EA_OnPreExitInstance

EA_OnPreExitInstance is not currently used.

Syntax

Sub EA_OnPreExitInstance (Repository As EA.Repository)

The EA_OnPreExitInstance function syntax contains thisparameter.

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

None.

(c) Sparx Systems 2018 Page 694 of 885

User Guide - Automation 26 July, 2018

EA_OnRetrieveModelTemplate

EA_OnRetrieveModelTemplate requests that an Add-Inpass a model template to Enterprise Architect. This eventoccurs when a user executes the 'Add a New Model UsingWizard' command to add a model that has been defined byan MDG Technology.

Syntax

Function EA_OnRetrieveModelTemplate (Repository AsEA.Repository, sLocation As String) As String

The EA_OnRetrieveModelTemplate function syntaxcontains these parameters.

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

sLocation StringDirection: INDescription: The name of the template

(c) Sparx Systems 2018 Page 695 of 885

User Guide - Automation 26 July, 2018

requested; this should match the locationattribute in the <ModelTemplates>section of an MDG Technology File.

Return Value

Return a string containing the XMI export of the model thatis being used as a template. Return an empty string if accessto the template is denied; the Add-In is to handle usernotification of the error.

Example

Public Function EA_OnRetrieveModelTemplate(ByRef RepAs EA.Repository, ByRef sLocation As String) As String

Dim sTemplate As String

Select Case sLocation

Case "Templates\Template1.xml"

sTemplate = My.Resources.Template1

Case "Templates\Template2.xml"

sTemplate = My.Resources.Template2

Case "Templates\Template3.xml"

sTemplate = My.Resources.Template3

(c) Sparx Systems 2018 Page 696 of 885

User Guide - Automation 26 July, 2018

Case Else

MsgBox("Path for " & sLocation & " not found")

sTemplate = ""

End Select

EA_OnRetrieveModelTemplate = sTemplate

End Function

(c) Sparx Systems 2018 Page 697 of 885

User Guide - Automation 26 July, 2018

EA_OnTabChanged

EA_OnTabChanged notifies Add-Ins that the currently opentab has changed.

Diagrams do not generate the message when they are firstopened - use the broadcast event EA_OnPostOpenDiagramfor this purpose.

Syntax

Function EA_OnTabChanged (Repository AsEA.Repository, TabName As String, DiagramID As Integer)

The EA_OnTabChanges function syntax contains theseparameters.

Parameter Type

DiagramID LongDirection: INDescription: The diagram ID, or 0 ifswitched to an Add-In tab.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members to

(c) Sparx Systems 2018 Page 698 of 885

User Guide - Automation 26 July, 2018

retrieve model data and user interfacestatus information.

TabName StringDirection: INDescription: The name of the tab towhich focus has been switched.

Return Value

None

(c) Sparx Systems 2018 Page 699 of 885

User Guide - Automation 26 July, 2018

Model Validation Broadcasts

Perform Model Validation from an Add-In

Using Enterprise Architect broadcasts, it is possible todefine a set of rules that are evaluated when the userinstructs Enterprise Architect to perform model validation.An Add-In that performs model validation would involvethese broadcast events.

Command Detail

EA_OnInitializeUserRules

EA_OnInitializeUserRules is interceptedin order to define rule categories andrules.

EA_OnStartValidation

EA_OnStartValidation can be interceptedto perform any required processing priorto validation.

EA_OnEndValidation

EA_OnEndValidation can be interceptedto perform any required clean-up aftervalidation has completed.

ValidateRequest

These functions intercept each request tovalidate an individual element, Package,diagram, connector, attribute and method.

(c) Sparx Systems 2018 Page 700 of 885

User Guide - Automation 26 July, 2018

ValidateElement

EA_OnRunElementRule

ValidatePackage

EA_OnRunPackageRule

ValidateDiagram

EA_OnRunDiagramRule

ValidateConnector

EA_OnRunConnectorRule

ValidateAttribute

EA_OnRunAttributeRule

ValidateMethod

EA_OnRunMethodRule

ValidateParameter

EA_OnRunParameterRule

(c) Sparx Systems 2018 Page 701 of 885

User Guide - Automation 26 July, 2018

EA_OnInitializeUserRules

EA_OnInitializeUserRules is called on Enterprise Architectstart-up and requests that the Add-In provide EnterpriseArchitect with a rule category and list of rule IDs for modelvalidation.

This function must be implemented by any Add-In that is toperform its own model validation. It must callProject.DefineRuleCategory once and Project.DefineRulefor each rule; these functions are described in the ProjectInterface topic.

Syntax

Sub EA_OnInitializeUserRules (Repository AsEA.Repository)

The EA_OnInitializeUserRules function syntax contains thisparameter.

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 702 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 703 of 885

User Guide - Automation 26 July, 2018

EA_OnStartValidation

EA_OnStartValidation notifies Add-Ins that a user hasinvoked the model validation command from EnterpriseArchitect.

Syntax

Sub EA_OnStartValidation (Repository As EA.Repository,ParamArray Args() as Variant)

The EA_OnStartValidation function syntax contains theseparameters.

Parameter Type

Args ParamArray of VariantDirection: INDescription: Contains a list of RuleCategories that are active for the currentinvocation of model validation.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interface

(c) Sparx Systems 2018 Page 704 of 885

User Guide - Automation 26 July, 2018

status information.

(c) Sparx Systems 2018 Page 705 of 885

User Guide - Automation 26 July, 2018

EA_OnEndValidation

EA_OnEndValidation notifies Add-Ins that modelvalidation has completed.

Use this event to arrange any clean-up operations arisingfrom the validation.

Syntax

Sub EA_OnEndValidation (Repository As EA.Repository,ParamArray Args() as Variant)

The EA_OnEndValidation function syntax contains theseparameters.

Parameter Type

Args ParamArray of VariantDirection: INDescription: Contains a list of RuleCategories that were active for theinvocation of model validation that hasjust completed.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open Enterprise

(c) Sparx Systems 2018 Page 706 of 885

User Guide - Automation 26 July, 2018

Architect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 707 of 885

User Guide - Automation 26 July, 2018

EA_OnRunElementRule

This event is triggered once for each rule defined inEA_OnInitializeUserRules to be performed on each elementin the selection being validated.

If you don't want to perform the rule defined by RuleID onthe given element, then simply return without performingany action.

On performing any validation, if a validation error is found,use the Repository.ProjectInterface.PublishResult method tonotify Enterprise Architect.

Syntax

Sub EA_OnRunElementRule (Repository AsEA.Repository, RuleID As String, Element As EA.Element)

The EA_OnRunElementRule function syntax contains theseparameters.

Parameter Type

Element EA.ElementDirection: INDescription: The element to potentiallyperform validation on.

Repository EA.Repository

(c) Sparx Systems 2018 Page 708 of 885

User Guide - Automation 26 July, 2018

Direction: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

RuleID StringDirection: INDescription: The ID that was passed intothe 'Project.DefineRule' command.

(c) Sparx Systems 2018 Page 709 of 885

User Guide - Automation 26 July, 2018

EA_OnRunPackageRule

This event is triggered once for each rule defined inEA_OnInitializeUserRules to be performed on each Packagein the selection being validated.

If you don't want to perform the rule defined by RuleID onthe given Package, then simply return without performingany action.

On performing any validation, if a validation error is found,use the Repository.ProjectInterface.PublishResult method tonotify Enterprise Architect.

Syntax

Sub EA_OnRunPackageRule (Repository AsEA.Repository, RuleID As String, PackageID As Long)

The EA_OnRunElementRule function syntax contains theseparameters.

Parameter Type

PackageID LongDirection: INDescription: The ID of the Package topotentially perform validation on. Use the'Repository.GetPackageByID' method toretrieve the Package object.

(c) Sparx Systems 2018 Page 710 of 885

User Guide - Automation 26 July, 2018

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

RuleID StringDirection: INDescription: The ID that was passed intothe 'Project.DefineRule' method.

(c) Sparx Systems 2018 Page 711 of 885

User Guide - Automation 26 July, 2018

EA_OnRunDiagramRule

This event is triggered once for each rule defined inEA_OnInitializeUserRules to be performed on each diagramin the selection being validated.

If you don't want to perform the rule defined by RuleID onthe given diagram, then simply return without performingany action.

On performing any validation, if a validation error is found,use the Repository.ProjectInterface.PublishResult method tonotify Enterprise Architect.

Syntax

Sub EA_OnRunDiagramRule (Repository AsEA.Repository, RuleID As String, DiagramID As Long)

The EA_OnRunDiagramRule function syntax contains theseparameters.

Parameter Type

DiagramID LongDirection: INDescription: The ID of the diagram topotentially perform validation on.Use the Repository.GetDiagramByIDmethod to retrieve the diagram object.

(c) Sparx Systems 2018 Page 712 of 885

User Guide - Automation 26 July, 2018

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

RuleID StringDirection: INDescription: The ID that was passed intothe 'Project.DefineRule' command.

(c) Sparx Systems 2018 Page 713 of 885

User Guide - Automation 26 July, 2018

EA_OnRunConnectorRule

This event is triggered once for each rule defined inEA_OnInitializeUserRules to be performed on eachconnector in the selection being validated.

If you don't want to perform the rule defined by RuleID onthe given connector, then simply return without performingany action.

On performing any validation, if a validation error is found,use the Repository.ProjectInterface.PublishResult method tonotify Enterprise Architect.

Syntax

Sub EA_OnRunConnectorRule (Repository AsEA.Repository, RuleID As String, ConnectorID As Long)

The EA_OnRunConnectorRule function syntax containsthese parameters.

Parameter Type

ConnectorID LongDirection: INDescription: The ID of the connector topotentially perform validation on.Use the 'Repository.GetConnectorByID'method to retrieve the connector object.

(c) Sparx Systems 2018 Page 714 of 885

User Guide - Automation 26 July, 2018

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

RuleID StringDirection: INDescription: The ID that was passed intothe 'Project.DefineRule' command.

(c) Sparx Systems 2018 Page 715 of 885

User Guide - Automation 26 July, 2018

EA_OnRunAttributeRule

This event is triggered once for each rule defined inEA_OnInitializeUserRules to be performed on each attributein the selection being validated.

If you don't want to perform the rule defined by RuleID onthe given attribute, then simply return without performingany action.

On performing any validation, if a validation error is found,use the Repository.ProjectInterface.PublishResult method tonotify Enterprise Architect.

Syntax:

Sub EA_OnRunAttributeRule (Repository AsEA.Repository, RuleID As String, AttributeGUID AsString, ObjectID As Long)

The EA_OnRunAttributeRule function syntax containsthese parameters.

Parameter Type

AttributeGUID

StringDirection: INDescription: The GUID of the attribute topotentially perform validation on.Use the 'Repository.GetAttributeByGuid'

(c) Sparx Systems 2018 Page 716 of 885

User Guide - Automation 26 July, 2018

method to retrieve the attribute object.

ObjectID LongDirection: INDescription: The ID of the object thatowns the given attribute. Use the'Repository.GetElementByID' method toretrieve the object.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

RuleID StringDirection: INDescription: The ID that was passed intothe 'Project.DefineRule' command.

(c) Sparx Systems 2018 Page 717 of 885

User Guide - Automation 26 July, 2018

EA_OnRunMethodRule

This event is triggered once for each rule defined inEA_OnInitializeUserRules to be performed on each methodin the selection being validated.

If you don't want to perform the rule defined by RuleID onthe given method, then simply return without performingany action.

On performing any validation, if a validation error is found,use the Repository.ProjectInterface.PublishResult method tonotify Enterprise Architect.

Syntax

Sub EA_OnRunMethodRule (Repository As EA.Repository,RuleID As String, MethodGUID As String, ObjectID AsLong)

The EA_OnRunMethodRule function syntax contains theseparameters.

Parameter Type

MethodGUID

StringDirection: INDescription: The GUID of the method topotentially perform validation on. Use the'Repository.GetMethodByGuid' method

(c) Sparx Systems 2018 Page 718 of 885

User Guide - Automation 26 July, 2018

to retrieve the method object.

ObjectID LongDirection: INDescription: The ID of the object thatowns the given method. Use the'Repository.GetElementByID' method toretrieve the object.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

RuleID StringDirection: INDescription: The ID that was passed intothe 'Project.DefineRule' command.

(c) Sparx Systems 2018 Page 719 of 885

User Guide - Automation 26 July, 2018

EA_OnRunParameterRule

This event is triggered once for each rule defined inEA_OnInitializeUserRules to be performed on eachparameter in the selection being validated.

If you don't want to perform the rule defined by RuleID onthe given parameter, then simply return without performingany action.

On performing any validation, if a validation error is found,use the Repository.ProjectInterface.PublishResult method tonotify Enterprise Architect.

Syntax

Sub EA_OnRunParameterRule (Repository AsEA.Repository, RuleID As String, ParameterGUID AsString, MethodGUID As String, ObjectID As Long)

The EA_OnRunMethodRule function syntax contains theseparameters.

Parameter Type

MethodGUID

StringDirection: INDescription: The GUID of the methodthat owns the given parameter. Use the'Repository.GetMethodByGuid' method

(c) Sparx Systems 2018 Page 720 of 885

User Guide - Automation 26 July, 2018

to retrieve the method object.

ObjectID LongDirection: INDescription: The ID of the object thatowns the given parameter. Use the'Repository.GetElementByID' method toretrieve the object.

ParameterGUID

StringDirection: INDescription: The GUID of the parameterto potentially perform validation on. Usethis to retrieve the parameter by iteratingthrough the 'Method.Parameters'collection.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

RuleID StringDirection: INDescription: The ID that was passed into

(c) Sparx Systems 2018 Page 721 of 885

User Guide - Automation 26 July, 2018

the 'Project.DefineRule' command.

(c) Sparx Systems 2018 Page 722 of 885

User Guide - Automation 26 July, 2018

Model Validation Example

This example code is written in C# and provides a skeletonmodel validation implementation that you might want to useas a starting point in writing your own model validationrules.

Main.cs

using System;

namespace myAddin

{

public class Main

{

public Rules theRules;

public Main()

{

theRules = new Rules();

}

public string EA_Connect(EA.Repository Repository)

{

return "";

}

public void EA_Disconnect()

{

(c) Sparx Systems 2018 Page 723 of 885

User Guide - Automation 26 July, 2018

GC.Collect();

GC.WaitForPendingFinalizers();

}

private bool IsProjectOpen(EA.Repository Repository)

{

try

{

EA.Collection c = Repository.Models;

return true;

}

catch

{

return false;

}

}

public object EA_GetMenuItems(EA.RepositoryRepository, string MenuLocation, string MenuName)

{

switch (MenuName)

{

case "":

return "-&myAddin";

case "-&myAddin":

string()  ar = { "&Test" };

return ar;

(c) Sparx Systems 2018 Page 724 of 885

User Guide - Automation 26 July, 2018

}

return "";

}

public void EA_GetMenuState(EA.RepositoryRepository, string MenuLocation, string MenuName,

string ItemName, ref bool IsEnabled, ref boolIsChecked)

{

// if no open project, disable all menu options

if (IsProjectOpen(Repository))

IsEnabled = true;

else

IsEnabled = false;

}

public void EA_MenuClick(EA.RepositoryRepository, string MenuLocation, string MenuName, stringItemName)

{

switch (ItemName)

{

case "&Test";

DoTest(Repository);

break;

}

}

(c) Sparx Systems 2018 Page 725 of 885

User Guide - Automation 26 July, 2018

public void EA_OnInitializeUserRules(EA.RepositoryRepository)

{

if (Repository != null)

{

theRules.ConfigureCategories(Repository);

theRules.ConfigureRules(Repository);

}

}

public void EA_OnRunElementRule(EA.RepositoryRepository, string RuleID, EA.Element element)

{

theRules.RunElementRule(Repository, RuleID,element);

}

public void EA_OnRunDiagramRule(EA.RepositoryRepository, string RuleID, long lDiagramID)

{

theRules.RunDiagramRule(Repository, RuleID,lDiagramID);

}

public void EA_OnRunConnectorRule(EA.RepositoryRepository, string RuleID, long lConnectorID)

{

theRules.RunConnectorRule(Repository, RuleID,lConnectorID);

(c) Sparx Systems 2018 Page 726 of 885

User Guide - Automation 26 July, 2018

}

public void EA_OnRunAttributeRule(EA.RepositoryRepository, string RuleID, string AttGUID, long lObjectID)

{

return;

}

public void EA_OnDeleteTechnology(EA.RepositoryRepository, EA.EventProperties Info)

{

return;

}

public void EA_OnImportTechnology(EA.RepositoryRepository, EA.EventProperties Info)

{

return;

}

private void DoTest(EA.Repository Rep)

{

// TODO: insert test code here

}

}

}

Rules.cs

(c) Sparx Systems 2018 Page 727 of 885

User Guide - Automation 26 July, 2018

using System;

using System.Collections;

namespace myAddin

{

public class Rules

{

private string m_sCategoryID;

private System.Collections.ArrayList m_RuleIDs;

private System.Collections.ArrayList m_RuleIDEx;

private const string cRule01 = "Rule01";

private const string cRule02 = "Rule02";

private const string cRule03 = "Rule03";

// TODO: expand this list as much as necessary

public Rules()

{

m_RuleIDs = new System.Collections.ArrayList();

m_RuleIDEx = newSystem.Collections.ArrayList();

}

private string LookupMap(string sKey)

{

return DoLookupMap(sKey, m_RuleIDs,m_RuleIDEx);

}

(c) Sparx Systems 2018 Page 728 of 885

User Guide - Automation 26 July, 2018

private string LookupMapEx(string sRule)

{

return DoLookupMap(sRule, m_RuleIDEx,m_RuleIDs);

}

private string DoLookupMap(string sKey, ArrayListarrValues, ArrayList arrKeys)

{

if (arrKeys.Contains(sKey))

returnarrValues(arrKeys.IndexOf(sKey)).ToString();

else

return "";

}

private void AddToMap(string sRuleID, string sKey)

{

m_RuleIDs.Add(sRuleID);

m_RuleIDEx.Add(sKey);

}

private string GetRuleStr(string sRuleID)

{

switch (sRuleID)

{

case cRule01:

return "Error Message 01";

(c) Sparx Systems 2018 Page 729 of 885

User Guide - Automation 26 July, 2018

case cRule02:

return "Error Message 02";

case cRule03:

return "Error Message 03";

// TODO: add extra cases as much as necessary

}

return "";

}

public void ConfigureCategories(EA.RepositoryRepository)

{

EA.Project Project =Repository.GetProjectInterface();

m_sCategoryID =Project.DefineRuleCategory("Enterprise CollaborationArchitecture (ECA) Rules");

}

public void ConfigureRules(EA.RepositoryRepository)

{

EA.Project Project =Repository.GetProjectInterface();

AddToMap(Project.DefineRule(m_sCategoryID,EA.EnumMVErrorType.mvError, GetRuleStr(cRule01)),cRule01);

AddToMap(Project.DefineRule(m_sCategoryID,

(c) Sparx Systems 2018 Page 730 of 885

User Guide - Automation 26 July, 2018

EA.EnumMVErrorType.mvError, GetRuleStr(cRule02)),cRule02);

AddToMap(Project.DefineRule(m_sCategoryID,EA.EnumMVErrorType.mvError, GetRuleStr(cRule03)),cRule03);

// TODO: expand this list

}

public void RunConnectorRule(EA.RepositoryRepository, string sRuleID, long lConnectorID)

{

EA.Connector Connector =Repository.GetConnectorByID((int)lConnectorID);

if (Connector != null)

{

switch (LookupMapEx(sRuleID))

{

case cRule02:

// TODO: perform rule 2 check

break;

// TODO: add more cases

}

}

}

public void RunDiagramRule(EA.RepositoryRepository, string sRuleID, long lDiagramID)

{

(c) Sparx Systems 2018 Page 731 of 885

User Guide - Automation 26 July, 2018

EA.Diagram Diagram =Repository.GetDiagramByID((int)lDiagramID);

if (Diagram != null)

{

switch (LookupMapEx(sRuleID))

{

case cRule03:

// TODO: perform rule 3 check

break;

// TODO: add more cases

}

}

}

public void RunElementRule(EA.RepositoryRepository, string sRuleID, EA.Element Element)

{

if (Element != null)

{

switch (LookupMapEx(sRuleID))

{

case cRule01:

DoRule01(Repository, Element);

break;

// TODO: add more cases

}

(c) Sparx Systems 2018 Page 732 of 885

User Guide - Automation 26 July, 2018

}

}

private void DoRule01(EA.Repository Repository,EA.Element Element)

{

if (Element.Stereotype != "myStereotype")

return;

// TODO: validation logic here

// report validation errors

EA.Project Project =Repository.GetProjectInterface();

Project.PublishResult(LookupMap(cRule01),EA.EnumMVErrorType.mvError, GetRuleStr(cRule01));

}

}

}

(c) Sparx Systems 2018 Page 733 of 885

User Guide - Automation 26 July, 2018

Post-New Events

Enterprise Architect Add-Ins can respond to the creation ofnew elements, connectors, objects, attributes, methods andPackages using these broadcast events:

Post-New Broadcast Events

Event

EA_OnPostNewElement

EA_OnPostNewConnector

EA_OnPostNewDiagram

EA_OnPostNewDiagramObject

EA_OnPostNewAttribute

EA_OnPostNewMethod

EA_OnPostNewPackage

EA_OnPostNewGlossaryTerm

(c) Sparx Systems 2018 Page 734 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 735 of 885

User Guide - Automation 26 July, 2018

EA_OnPostNewElement

EA_OnPostNewElement notifies Add-Ins that a newelement has been created on a diagram. It enables Add-Insto modify the element upon creation.

This event occurs after a user has dragged a new elementfrom the Toolbox or Resources window onto a diagram. Thenotification is provided immediately after the element isadded to the model.

Set Repository.SuppressEADialogs to True to suppressEnterprise Architect from showing its default 'Properties'dialog.

Syntax

Function EA_OnPostNewElement (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPostNewElement function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the new element:

ElementID: A long value·

(c) Sparx Systems 2018 Page 736 of 885

User Guide - Automation 26 July, 2018

corresponding to Element.ElementID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True if the element has been updated during thisnotification. Return False otherwise.

(c) Sparx Systems 2018 Page 737 of 885

User Guide - Automation 26 July, 2018

EA_OnPostNewConnector

EA_OnPostNewConnector notifies Add-Ins that a newconnector has been created on a diagram. It enables Add-Insto modify the connector upon creation.

This event occurs after a user has dragged a new connectorfrom the Toolbox or Resources window onto a diagram. Thenotification is provided immediately after the connector isadded to the model.

Syntax

Function EA_OnPostNewConnector (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPostNewConnector function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the new connector:

ConnectorID: A long value·

corresponding toConnector.ConnectorID

(c) Sparx Systems 2018 Page 738 of 885

User Guide - Automation 26 July, 2018

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True if the connector has been updated during thisnotification. Return False otherwise.

(c) Sparx Systems 2018 Page 739 of 885

User Guide - Automation 26 July, 2018

EA_OnPostNewDiagram

EA_OnPostNewDiagram notifies Add-Ins that a newdiagram has been created. It enables Add-Ins to modify thediagram upon creation.

Syntax

Function EA_OnPostNewDiagram (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPostNewDiagram function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the new diagram:

DiagramID: A long value·

corresponding to Diagram.PackageID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members to

(c) Sparx Systems 2018 Page 740 of 885

User Guide - Automation 26 July, 2018

retrieve model data and user interfacestatus information.

Return Value

Return True if the diagram has been updated during thisnotification. Return False otherwise.

(c) Sparx Systems 2018 Page 741 of 885

User Guide - Automation 26 July, 2018

EA_OnPostNewDiagramObject

EA_OnPostNewDiagramObject notifies Add-Ins that a newobject has been created on a diagram. It enables Add-Ins tomodify the object upon creation.

This event occurs after a user has dragged a new object fromthe Project Browser or Resources window onto a diagram.The notification is provided immediately after the object isadded to the diagram.

Syntax

Function EA_OnPostNewDiagramObject (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPostNewDiagramObject function syntaxcontains these parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the newelement:

ID: A long value corresponding to the·

ElementID of the object that has beenadded to the diagram

(c) Sparx Systems 2018 Page 742 of 885

User Guide - Automation 26 July, 2018

DiagramID: A long value·

corresponding to the DiagramID of thediagram to which the object has beenaddedDUID: A string value for the DUID;·

can be used withDiagram.GetDiagramObjectByID toretrieve the new DiagramObject

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True if the element has been updated during thisnotification. Return False otherwise.

(c) Sparx Systems 2018 Page 743 of 885

User Guide - Automation 26 July, 2018

EA_OnPostNewAttribute

EA_OnPostNewAttribute notifies Add-Ins that a newattribute has been created on a diagram. It enables Add-Insto modify the attribute upon creation.

This event occurs when a user creates a new attribute on anelement by either drag-and-dropping from the ProjectBrowser, using the 'Attributes' tab of the Features window,or using the in-place editor on the diagram. The notificationis provided immediately after the attribute is created.

Syntax

Function EA_OnPostNewAttribute (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPostNewAttribute function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the new attribute:

AttributeID: A long value·

corresponding to Attribute.AttributeID

(c) Sparx Systems 2018 Page 744 of 885

User Guide - Automation 26 July, 2018

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True if the attribute has been updated during thisnotification. Return False otherwise.

(c) Sparx Systems 2018 Page 745 of 885

User Guide - Automation 26 July, 2018

EA_OnPostNewMethod

EA_OnPostNewMethod notifies Add-Ins that a new methodhas been created on a diagram. It enables Add-Ins to modifythe method upon creation.

This event occurs when a user creates a new method on anelement by either drag-dropping from the Project Browser,using the method's 'Properties' dialog, or using the in-placeeditor on the diagram. The notification is providedimmediately after the method is created.

Syntax

Function EA_OnPostNewMethod (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPostNewMethod function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the new method:

MethodID: A long value corresponding·

to Method.MethodID

(c) Sparx Systems 2018 Page 746 of 885

User Guide - Automation 26 July, 2018

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True if the method has been updated during thisnotification. Return False otherwise.

(c) Sparx Systems 2018 Page 747 of 885

User Guide - Automation 26 July, 2018

EA_OnPostNewPackage

EA_OnPostNewPackage notifies Add-Ins that a newPackage has been created on a diagram. It enables Add-Insto modify the Package upon creation.

This event occurs when a user drags a new Package fromthe Toolbox or Resources window onto a diagram, or byselecting the New Package icon from the Project Browser.

Syntax

Function EA_OnPostNewPackage (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPostNewPackage function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the new Package:

PackageID: A long value·

corresponding to Package.PackageID

Repository EA.RepositoryDirection: IN

(c) Sparx Systems 2018 Page 748 of 885

User Guide - Automation 26 July, 2018

Description: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True if the Package has been updated during thisnotification. Return False otherwise.

(c) Sparx Systems 2018 Page 749 of 885

User Guide - Automation 26 July, 2018

EA_OnPostNewGlossaryTerm

EA_OnPostNewGlossaryTerm notifies Add-Ins that a newglossary term has been created. It enables Add-Ins to modifythe glossary term upon creation.

The notification is provided immediately after the glossaryterm is added to the model.

Syntax

Function EA_OnPostNewGlossaryTerm (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPostNewGlossaryTerm function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the newglossary term:

TermID: A string value corresponding·

to Term.TermIDTerm: A string value corresponding to·

the name of the glossary term beingcreated

(c) Sparx Systems 2018 Page 750 of 885

User Guide - Automation 26 July, 2018

Meaning: A string value corresponding·

to meaning of the glossary term beingcreated

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True if the glossary term has been updated duringthis notification. Return False otherwise.

(c) Sparx Systems 2018 Page 751 of 885

User Guide - Automation 26 July, 2018

Pre-Deletion Events

Enterprise Architect Add-Ins can respond to requests todelete elements, attributes, methods, connectors, diagrams,Packages and glossary terms using these broadcast events:

Pre-Deletion Broadcast Events

Event

EA_OnPreDeleteElement

EA_OnPreDeleteAttribute

EA_OnPreDeleteMethod

EA_OnPreDeleteConnector

EA_OnPreDeleteDiagram

EA_OnPreDeletePackage

EA_OnPreDeleteGlossaryTerm

EA_OnPreDeleteTechnology (Deprecated)

(c) Sparx Systems 2018 Page 752 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 753 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDeleteElement

EA_OnPreDeleteElement notifies Add-Ins that an elementis to be deleted from the model. It enables Add-Ins to permitor deny deletion of the element.

This event occurs when a user deletes an element from theProject Browser or on a diagram. The notification isprovided immediately before the element is deleted, so thatthe Add-In can disable deletion of the element.

Syntax

Function EA_OnPreDeleteElement (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDeleteElement function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the element to be deleted:

ElementID: A long value·

corresponding to Element.ElementID

Repository EA.Repository

(c) Sparx Systems 2018 Page 754 of 885

User Guide - Automation 26 July, 2018

Direction: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable deletion of the element from themodel. Return False to disable deletion of the element.

(c) Sparx Systems 2018 Page 755 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDeleteAttribute

EA_OnPreDeleteAttribute notifies Add-Ins that an attributeis to be deleted from the model. It enables Add-Ins to permitor deny deletion of the attribute.

This event occurs when a user attempts to permanentlydelete an attribute from the Project Browser. Thenotification is provided immediately before the attribute isdeleted, so that the Add-In can disable deletion of theattribute.

Syntax

Function EA_OnPreDeleteAttribute (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDeleteAttribute function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the attribute to be deleted:

AttributeID: A long value·

corresponding to Attribute.AttributeID

(c) Sparx Systems 2018 Page 756 of 885

User Guide - Automation 26 July, 2018

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable deletion of the attribute from themodel. Return False to disable deletion of the attribute.

(c) Sparx Systems 2018 Page 757 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDeleteMethod

EA_OnPreDeleteMethod notifies Add-Ins that a method(operation) is to be deleted from the model. It enablesAdd-Ins to permit or deny deletion of the method.

This event occurs when a user attempts to permanentlydelete a method from the Project Browser. The notificationis provided immediately before the method is deleted, sothat the Add-In can disable deletion of the method.

Syntax

Function EA_OnPreDeleteMethod (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDeleteMethod function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the method to be deleted:

MethodID: A long value corresponding·

to Method.MethodID

Repository EA.Repository

(c) Sparx Systems 2018 Page 758 of 885

User Guide - Automation 26 July, 2018

Direction: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable deletion of the method from themodel. Return False to disable deletion of the method.

(c) Sparx Systems 2018 Page 759 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDeleteConnector

EA_OnPreDeleteConnector notifies Add-Ins that aconnector is to be deleted from the model. It enablesAdd-Ins to permit or deny deletion of the connector.

This event occurs when a user attempts to permanentlydelete a connector on a diagram. The notification isprovided immediately before the connector is deleted, sothat the Add-In can disable deletion of the connector.

Syntax

Function EA_OnPreDeleteConnector (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDeleteConnector function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the connector to be deleted:

ConnectorID: A long value·

corresponding toConnector.ConnectorID

(c) Sparx Systems 2018 Page 760 of 885

User Guide - Automation 26 July, 2018

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable deletion of the connector from themodel. Return False to disable deletion of the connector.

(c) Sparx Systems 2018 Page 761 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDeleteDiagram

EA_OnPreDeleteDiagram notifies Add-Ins that a diagram isto be deleted from the model. It enables Add-Ins to permitor deny deletion of the diagram.

This event occurs when a user attempts to permanentlydelete a diagram from the Project Browser. The notificationis provided immediately before the diagram is deleted, sothat the Add-In can disable deletion of the diagram.

Syntax

Function EA_OnPreDeleteDiagram (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDeleteDiagram function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the diagram to be deleted:

DiagramID: A long value·

corresponding to Diagram.DiagramID

Repository EA.Repository

(c) Sparx Systems 2018 Page 762 of 885

User Guide - Automation 26 July, 2018

Direction: INDescription: An EA.Repository objectrepresenting the currently-openEnterprise Architect model. Poll itsmembers to retrieve model data and userinterface status information.

Return Value

Return True to enable deletion of the diagram from themodel. Return False to disable deletion of the diagram.

(c) Sparx Systems 2018 Page 763 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDeleteDiagramObject

EA_OnPreDeleteDiagramObject notifies Add-Ins that adiagram object is to be deleted from the model. It enablesAdd-Ins to permit or deny deletion of the element.

This event occurs when a user attempts to permanentlydelete an element from a diagram. The notification isprovided immediately before the element is deleted, so thatthe Add-In can disable deletion of the element.

Syntax

Function EA_OnPreDeleteDiagramObject (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDeleteDiagramObject function syntaxcontains these parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the element to be deleted:

ID: A long value corresponding to·

DiagramObject.ElementID

Repository EA.Repository

(c) Sparx Systems 2018 Page 764 of 885

User Guide - Automation 26 July, 2018

Direction: INDescription: An EA.Repository objectrepresenting the currently-openEnterprise Architect model. Poll itsmembers to retrieve model data and userinterface status information.

Return Value

Return True to enable deletion of the element from themodel. Return False to disable deletion of the element.

(c) Sparx Systems 2018 Page 765 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDeletePackage

EA_OnPreDeletePackage notifies Add-Ins that a Package isto be deleted from the model. It enables Add-Ins to permitor deny deletion of the Package.

This event occurs when a user attempts to permanentlydelete a Package from the Project Browser. The notificationis provided immediately before the Package is deleted, sothat the Add-In can disable deletion of the Package.

Syntax

Function EA_OnPreDeletePackage (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDeletePackage function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the Package to be deleted:

PackageID: A long value·

corresponding to Package.PackageID

Repository EA.Repository

(c) Sparx Systems 2018 Page 766 of 885

User Guide - Automation 26 July, 2018

Direction: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable deletion of the Package from themodel. Return False to disable deletion of the Package.

(c) Sparx Systems 2018 Page 767 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDeleteGlossaryTerm

EA_OnPreDeleteGlossaryTerm notifies Add-Ins that aglossary term is to be deleted from the model. It enablesAdd-Ins to permit or deny deletion of the glossary term.

The notification is provided immediately before the glossaryterm is deleted, so that the Add-In can disable deletion ofthe glossary term.

Syntax

Function EA_OnPreDeleteGlossaryTerm (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDeleteGlossaryTerm function syntaxcontains these parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the glossary term to be deleted:

TermID: A long value corresponding to·

Term.TermID

Repository EA.RepositoryDirection: IN

(c) Sparx Systems 2018 Page 768 of 885

User Guide - Automation 26 July, 2018

Description: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable deletion of the glossary term from themodel. Return False to disable deletion of the glossary term.

(c) Sparx Systems 2018 Page 769 of 885

User Guide - Automation 26 July, 2018

Pre New-Object Events

When you create an Add-In, you can include broadcastevents to intercept and respond to requests to create newobjects, including elements, connectors, diagram objects,attributes, methods and Packages.

Events to intercept

Event

Creation of a new element

Creation of a new connector

Creation of a new diagram

Creation of a new diagram object

Creation of a new element by dropping onto a diagramfrom the Project Browser.

Creation of a new attribute

Creation of a new method

Creation of a new Package

(c) Sparx Systems 2018 Page 770 of 885

User Guide - Automation 26 July, 2018

Creation of a new glossary term

(c) Sparx Systems 2018 Page 771 of 885

User Guide - Automation 26 July, 2018

EA_OnPreNewElement

EA_OnPreNewElement notifies Add-Ins that a new elementis about to be created on a diagram. It enables Add-Ins topermit or deny creation of the new element.

This event occurs when a user drags a new element from theToolbox or Resources window onto a diagram. Thenotification is provided immediately before the element iscreated, so that the Add-In can disable addition of theelement.

Syntax

Function EA_OnPreNewElement (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreNewElement function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the element tobe created:

Type: A string value corresponding to·

Element.Type

(c) Sparx Systems 2018 Page 772 of 885

User Guide - Automation 26 July, 2018

FQStereotype: A string value·

corresponding toElement.FQStereotypeStereotype: A string value·

corresponding to Element.StereotypeParentID: A long value corresponding·

to Element.ParentIDDiagramID: A long value·

corresponding to the ID of the diagramto which the element is being added

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable addition of the new element to themodel. Return False to disable addition of the new element.

(c) Sparx Systems 2018 Page 773 of 885

User Guide - Automation 26 July, 2018

EA_OnPreNewConnector

EA_OnPreNewConnector notifies Add-Ins that a newconnector is about to be created on a diagram. It enablesAdd-Ins to permit or deny creation of a new connector.

This event occurs when a user drags a new connector fromthe Toolbox or Resources window, onto a diagram. Thenotification is provided immediately before the connector iscreated, so that the Add-In can disable addition of theconnector.

Syntax

Function EA_OnPreNewConnector (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreNewConnector function syntax containsthese elements:

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the connectorto be created:

Type: A string value corresponding to·

Connector.Type

(c) Sparx Systems 2018 Page 774 of 885

User Guide - Automation 26 July, 2018

Subtype: A string value corresponding·

to Connector.SubtypeStereotype: A string value·

corresponding to Connector.StereotypeClientID: A long value corresponding·

to Connector.ClientIDSupplierID: A long value·

corresponding to Connector.SupplierIDDiagramID: A long value·

corresponding toConnector.DiagramID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable addition of the new connector to themodel. Return False to disable addition of the newconnector.

(c) Sparx Systems 2018 Page 775 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 776 of 885

User Guide - Automation 26 July, 2018

EA_OnPreNewDiagram

EA_OnPreNewDiagram notifies Add-Ins that a newdiagram is about to be created. It enables Add-Ins to permitor deny creation of the new diagram.

The notification is provided immediately before the diagramis created, so that the Add-In can disable addition of thediagram.

Syntax

Function EA_OnPreNewDiagram (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreNewDiagram function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the diagram tobe created:

Type: A string value corresponding to·

Diagram.TypeParentID: A long value corresponding·

to Diagram.ParentID

(c) Sparx Systems 2018 Page 777 of 885

User Guide - Automation 26 July, 2018

PackageID: A long value·

corresponding to Diagram.PackageID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable addition of the new diagram to themodel. Return False to disable addition of the new diagram.

(c) Sparx Systems 2018 Page 778 of 885

User Guide - Automation 26 July, 2018

EA_OnPreNewDiagramObject

EA_OnPreNewDiagramObject notifies Add-Ins that a newdiagram object is about to be dropped on a diagram. Itenables Add-Ins to permit or deny creation of the newobject.

This event occurs when a user drags an object from theEnterprise Architect Project Browser or Resources windowonto a diagram. The notification is provided immediatelybefore the object is created, so that the Add-In can disableaddition of the object.

Syntax

Function EA_OnPreNewDiagramObject (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreNewDiagramObject function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the object to becreated:

Type: A string value corresponding to·

the Type of object being added to the

(c) Sparx Systems 2018 Page 779 of 885

User Guide - Automation 26 July, 2018

diagramStereotype: A string value·

corresponding to the Stereotype of theobject being added to the diagramID: A long value corresponding to the·

ID of the Element, Package or Diagrambeing added to the diagramDiagramID: A long value·

corresponding to the ID of the diagramto which the object is being added

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable addition of the object to the model.Return False to disable addition of the object.

(c) Sparx Systems 2018 Page 780 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDropFromTree

When a user drags any kind of element from the ProjectBrowser onto a diagram, EA_OnPreDropFromTree notifiesthe Add-In that a new item is about to be dropped onto adiagram. The notification is provided immediately beforethe element is dropped, so that the Add-In can override thedefault action that would be taken for this drag.

Syntax

Function EA_OnPreDropFromTree (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDropFromTree function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the element tobe created:

ID: A long value of the type being·

droppedType: A string value corresponding to·

type of element being dropped

(c) Sparx Systems 2018 Page 781 of 885

User Guide - Automation 26 July, 2018

DiagramID: A long value·

corresponding to the ID of the diagramto which the element is being addedPositionX: The X coordinate into·

which the element is being droppedPositionY: The Y coordinate into·

which the element is being droppedDroppedID: A long value·

corresponding to the ID of the elementthe item has been dropped onto

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to allow the default behavior to be executed.Return False if you are overriding this behavior.

(c) Sparx Systems 2018 Page 782 of 885

User Guide - Automation 26 July, 2018

EA_OnPreNewAttribute

EA_OnPreNewAttribute notifies Add-Ins that a newattribute is about to be created on an element. It enablesAdd-Ins to permit or deny creation of the new attribute.

This event occurs when a user creates a new attribute on anelement by either drag-dropping from the Project Browser,using the 'Attributes' tab of the Features window, or usingthe in-place editor on the diagram. The notification isprovided immediately before the attribute is created, so thatthe Add-In can disable addition of the attribute.

Syntax

Function EA_OnPreNewAttribute (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreNewAttribute function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the attribute tobe created:

Type: A string value corresponding to·

(c) Sparx Systems 2018 Page 783 of 885

User Guide - Automation 26 July, 2018

Attribute.TypeStereotype: A string value·

corresponding to Attribute.StereotypeParentID: A long value corresponding·

to Attribute.ParentIDClassifierID: A long value·

corresponding to Attribute.ClassifierID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable addition of the new attribute to themodel. Return False to disable addition of the new attribute.

(c) Sparx Systems 2018 Page 784 of 885

User Guide - Automation 26 July, 2018

EA_OnPreNewMethod

EA_OnPreNewMethod notifies Add-Ins that a new methodis about to be created on an element. It enables Add-Ins topermit or deny creation of the new method.

This event occurs when a user creates a new method on anelement by either drag-dropping from the Project Browser,using the 'Operations' tab of the Features window, or usingthe in-place editor on the diagram. The notification isprovided immediately before the method is created, so thatthe Add-In can disable addition of the method.

Syntax

Function EA_OnPreNewMethod (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreNewMethod function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the method tobe created:

ReturnType: A string value·

(c) Sparx Systems 2018 Page 785 of 885

User Guide - Automation 26 July, 2018

corresponding to Method.ReturnTypeStereotype: A string value·

corresponding to Method.StereotypeParentID: A long value corresponding·

to Method.ParentIDClassifierID: A long value·

corresponding to Method.ClassifierID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable addition of the new method to themodel. Return False to disable addition of the new method.

(c) Sparx Systems 2018 Page 786 of 885

User Guide - Automation 26 July, 2018

EA_OnPreNewPackage

EA_OnPreNewPackage notifies Add-Ins that a new Packageis about to be created in the model. It enables Add-Ins topermit or deny creation of the new Package.

This event occurs when a user drags a new Package fromthe Toolbox or Resources window onto a diagram, or byselecting the New Package icon from  the Project Browser.The notification is provided immediately before the Packageis created, so that the Add-In can disable addition of thePackage.

Syntax

Function EA_OnPreNewPackage (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreNewPackage function syntax contains theseparameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the Package tobe created:

Stereotype: A string value·

(c) Sparx Systems 2018 Page 787 of 885

User Guide - Automation 26 July, 2018

corresponding to Package.StereotypeParentID: A long value corresponding·

to Package.ParentIDDiagramID: A long value·

corresponding to the ID of the diagramto which the Package is being added

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable addition of the new Package to themodel. Return False to disable addition of the new Package.

(c) Sparx Systems 2018 Page 788 of 885

User Guide - Automation 26 July, 2018

EA_OnPreNewGlossaryTerm

EA_OnPreNewGlossaryTerm notifies Add-Ins that a newglossary term is about to be created. It enables Add-Ins topermit or deny creation of the new glossary term.

The notification is provided immediately before the glossaryterm is created, so that the Add-In can disable addition ofthe element.

Syntax

Function EA_OnPreNewGlossaryTerm (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreNewGlossaryTerm function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the glossaryterm to be created:

TermID: A string value corresponding·

to Term.TermIDTerm: A string value corresponding to·

the name of the glossary term being

(c) Sparx Systems 2018 Page 789 of 885

User Guide - Automation 26 July, 2018

createdMeaning: A string value corresponding·

to meaning of the glossary term beingcreated

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable addition of the new glossary term tothe model. Return False to disable addition of the newglossary term.

(c) Sparx Systems 2018 Page 790 of 885

User Guide - Automation 26 July, 2018

Tagged Value Broadcasts

Enterprise Architect includes the Addin Broadcast TaggedValue type that allows an Add-In to respond to attempts toedit it. The function that is called depends on the type ofobject the Tagged Value is on.

Tagged Value Broadcast Events

Event

EA_OnAttributeTagEdit

EA_OnConnectorTagEdit

EA_OnElementTagEdit

EA_OnMethodTagEdit

(c) Sparx Systems 2018 Page 791 of 885

User Guide - Automation 26 July, 2018

EA_OnAttributeTagEdit

EA_OnAttributeTagEdit is called when the user clicks the button for a Tagged Value of type AddinBroadcast on an

attribute.

The Add-In displays fields to show and change the valueand notes; this function provides the initial values for theTagged Value notes and value, and takes on any changes onexit of the function.

Syntax

Sub EA_OnAttributeTagEdit (Repository AsEA.Repository, AttributeID As Long, String TagName,String TagValue, String TagNotes)

The EA_OnAttributeTagEdit function syntax contains theseparameters.

Parameter Type

AttributeID LongDirection: INDescription: The ID of the attribute thatthis Tagged Value is on.

Repository EA.RepositoryDirection: IN

(c) Sparx Systems 2018 Page 792 of 885

User Guide - Automation 26 July, 2018

Description: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

TagName StringDirection: INDescription: The name of the TaggedValue to edit.

TagNotes StringDirection: INOUTDescription: The current value of theTagged Value notes; if the value isupdated, the new value is stored in therepository on exit of the function.

TagValue StringDirection: INOUTDescription: The current value of the tag;if the value is updated, the new value isstored in the repository on exit of thefunction.

(c) Sparx Systems 2018 Page 793 of 885

User Guide - Automation 26 July, 2018

EA_OnConnectorTagEdit

EA_OnConnectorTagEdit is called when the user clicks the button for a Tagged Value of type AddinBroadcast on a

connector.

The Add-In displays fields to show and change the valueand notes; this function provides the initial values for theTagged Value notes and value, and takes on any changes onexit of the function.

Syntax

Sub EA_OnConnectorTagEdit (Repository AsEA.Repository, ConnectorID As Long, String TagName,String TagValue, String TagNotes)

The EA_OnConnectorTagEdit function syntax containsthese parameters.

Parameter Type

ConnectorID LongDirection: INDescription: The ID of the connector thatthis Tagged Value is on.

Repository EA.RepositoryDirection: IN

(c) Sparx Systems 2018 Page 794 of 885

User Guide - Automation 26 July, 2018

Description: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model.Poll its members to retrieve model dataand user interface status information.

TagName StringDirection: INDescription: The name of the TaggedValue to edit.

TagNotes StringDirection: INOUTDescription: The current value of theTagged Value notes; if the value isupdated, the new value is stored in therepository on exit of the function.

TagValue StringDirection: INOUTDescription: The current value of the tag;if the value is updated, the new value isstored in the repository on exit of thefunction.

(c) Sparx Systems 2018 Page 795 of 885

User Guide - Automation 26 July, 2018

EA_OnElementTagEdit

EA_OnElementTagEdit is called when the user clicks the button for a Tagged Value of type AddinBroadcast on anelement.

The Add-In displays fields to show and change the valueand notes; this function provides the initial values for theTagged Value notes and value, and takes on any changes onexit of the function.

Syntax

Sub EA_OnElementTagEdit (Repository As EA.Repository,ObjectID As Long, String TagName, String TagValue,String TagNotes)

The EA_OnElementTagEdit function syntax contains theseelements:

Parameter Type

ObjectID LongDirection: INDescription: The ID of the object(element) that this Tagged Value is on.

Repository EA.RepositoryDirection: IN

(c) Sparx Systems 2018 Page 796 of 885

User Guide - Automation 26 July, 2018

Description: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

TagName StringDirection: INDescription: The name of the TaggedValue to edit.

TagNotes StringDirection: INOUTDescription: The current value of theTagged Value notes; if the value isupdated, the new value is stored in therepository on exit of the function.

TagValue StringDirection: INOUTDescription: The current value of the tag;if the value is updated, the new value isstored in the repository on exit of thefunction.

(c) Sparx Systems 2018 Page 797 of 885

User Guide - Automation 26 July, 2018

EA_OnMethodTagEdit

EA_OnMethodTagEdit is called when the user clicks the button for a Tagged Value of type AddinBroadcast on anoperation.

The Add-In displays fields to show and change the valueand notes; this function provides the initial values for theTagged Value notes and value, and takes on any changes onexit of the function.

Syntax

Sub EA_OnMethodTagEdit (Repository As EA.Repository,MethodID As Long, String TagName, String TagValue,String TagNotes)

The EA_OnMethodTagEdit function syntax contains theseelements:

Parameter Type

MethodID LongDirection: INDescription: The ID of the method thatthis Tagged Value is on.

Repository EA.RepositoryDirection: IN

(c) Sparx Systems 2018 Page 798 of 885

User Guide - Automation 26 July, 2018

Description: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

TagName StringDirection: INDescription: The name of the TaggedValue to edit.

TagNotes StringDirection: INOUTDescription: The current value of theTagged Value notes; if the value isupdated, the new value is stored in therepository on exit of the function.

TagValue StringDirection: INOUTDescription: The current value of the tag;if the value is updated, the new value isstored in the repository on exit of thefunction.

(c) Sparx Systems 2018 Page 799 of 885

User Guide - Automation 26 July, 2018

Technology Events

Enterprise Architect Add-Ins can respond to eventsassociated with the use of MDG Technologies.

Technology Broadcast Events

Event

EA_OnInitializeTechnologies

EA_OnPreActivateTechnology

EA_OnPostActivateTechnology

EA_OnPreDeleteTechnology (Deprecated)

EA_OnDeleteTechnology (Deprecated)

EA_OnImportTechnology (Deprecated)

(c) Sparx Systems 2018 Page 800 of 885

User Guide - Automation 26 July, 2018

EA_OnInitializeTechnologies

EA_OnInitializeTechnologies requests that an Add-In passan MDG Technology to Enterprise Architect for loading.

This event occurs on Enterprise Architect startup. Returnyour technology XML to this function and EnterpriseArchitect loads and enables it.

Syntax

Function EA_OnInitializeTechnologies (Repository AsEA.Repository) As Object

The EA_OnInitializeTechnologies function syntax containsthis parameter:

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 801 of 885

User Guide - Automation 26 July, 2018

Return Value

Return the MDG Technology as a single XML string.

Example

Public Function EA_OnInitializeTechnologies(ByValRepository As EA.Repository) As Object

EA_OnInitializeTechnologies =My.Resources.MyTechnology

End Function

(c) Sparx Systems 2018 Page 802 of 885

User Guide - Automation 26 July, 2018

EA_OnPreActivateTechnology

EA_OnPreActivateTechnology notifies Add-Ins that anMDG Technology resource is about to be activated in themodel.

This event occurs when a user selects to activate an MDGTechnology resource in the model (by clicking on the SetActive button on the 'MDG Technologies' dialog or byselecting the technology in the list box in the Default Toolstoolbar).

The notification is provided immediately after the userattempts to activate the MDG Technology, so that theAdd-In can permit or disable activation of the Technology.

Syntax

Function EA_OnPreActivateTechnology (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreActivateTechnology function syntaxcontains these parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the MDG

(c) Sparx Systems 2018 Page 803 of 885

User Guide - Automation 26 July, 2018

Technology to be activated:TechnologyID: A string value·

corresponding to the MDG TechnologyID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True to enable activation of the MDG Technologyresource in the model. Return False to disable activation ofthe MDG Technology resource.

(c) Sparx Systems 2018 Page 804 of 885

User Guide - Automation 26 July, 2018

EA_OnPostActivateTechnology

EA_OnPostActivateTechnology notifies Add-Ins that anMDG Technology resource has been activated in the model.

This event occurs when a user activates an MDGTechnology resource in the model (by clicking on the SetActive button on the 'MDG Technologies' dialog, or byselecting the technology in the list box in the Default Toolstoolbar).

The notification is provided immediately after the usersucceeds in activating the MDG Technology, so that theAdd-In can update the Technology if necessary.

Syntax

Function EA_OnPostActivateTechnology (Repository AsEA.Repository, Info As EA.EventProperties)

The EA_OnPostActivateTechnology function syntaxcontains these parameters:

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects for the MDGTechnology to be activated:

(c) Sparx Systems 2018 Page 805 of 885

User Guide - Automation 26 July, 2018

TechnologyID: A string value·

corresponding to the MDG TechnologyID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return True if the MDG Technology resource is updatedduring this notification. Return False otherwise.

(c) Sparx Systems 2018 Page 806 of 885

User Guide - Automation 26 July, 2018

EA_OnPreDeleteTechnology

Deprecated - refers to deleting a technology through theResources window; this process is no longer recommended.See Deploy An MDG Technology for information onrecommended methods for using technologies.

EA_OnPreDeleteTechnology notifies Add-Ins that an MDGTechnology resource is about to be deleted from the model.

This event occurs when a user deletes an MDG Technologyresource from the model.

The notification is provided immediately after the userconfirms their request to delete the MDG Technology, sothat the Add-In can disable deletion of the MDGTechnology.

Related Broadcast Events

Event

EA_OnInitializeTechnologies

EA_OnPreActivateTechnology

EA_OnPostActivateTechnology

(c) Sparx Systems 2018 Page 807 of 885

User Guide - Automation 26 July, 2018

Syntax

Function EA_OnPreDeleteTechnology (Repository AsEA.Repository, Info As EA.EventProperties) As Boolean

The EA_OnPreDeleteTechnology function syntax containsthese elements:

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains this EventPropertyobject for the MDG Technology to bedeleted:

TechnologyID: A string value·

corresponding to the MDG TechnologyID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 808 of 885

User Guide - Automation 26 July, 2018

Return Value

Return True to enable deletion of the MDG Technologyresource from the model. Return False to disable deletion ofthe MDG Technology resource.

(c) Sparx Systems 2018 Page 809 of 885

User Guide - Automation 26 July, 2018

EA_OnDeleteTechnology

Deprecated - refers to deleting a technology through theResources window; this process is no longer recommended.See Deploy An MDG Technology for information ofrecommended methods for using technologies.

EA_OnDeleteTechnology notifies Add-Ins that an MDGTechnology resource has been deleted from the model.

This event occurs after a user has deleted an MDGTechnology resource from the model. Add-Ins that requirean MDG Technology resource to be loaded can catch thisevent to disable certain functionality.

Related Events

Event

EA_OnInitializeTechnologies

EA_OnPreActivateTechnology

EA_OnPostActivateTechnology

Syntax

(c) Sparx Systems 2018 Page 810 of 885

User Guide - Automation 26 July, 2018

Sub EA_OnDeleteTechnology (Repository AsEA.Repository, Info As EA.EventProperties)

The EA_OnDeleteTechnology function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects:

TechnologyID: A string value·

corresponding to the MDG TechnologyID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

(c) Sparx Systems 2018 Page 811 of 885

User Guide - Automation 26 July, 2018

None.

(c) Sparx Systems 2018 Page 812 of 885

User Guide - Automation 26 July, 2018

EA_OnImportTechnology

Deprecated - refers to importing a technology into theResources window; this process is no longer recommended.See Deploy An MDG Technology for information ofrecommended methods for using technologies.

EA_OnImportTechnology notifies Add-Ins that you haveimported an MDG Technology resource into the model.

This event occurs after you have imported an MDGTechnology resource into the model. Add-Ins that require anMDG Technology resource to be loaded can catch thisAdd-In to enable certain functionality.

Related Events

Event

EA_OnInitializeTechnologies

EA_OnPreActivateTechnology

EA_OnPostActivateTechnology

Syntax

(c) Sparx Systems 2018 Page 813 of 885

User Guide - Automation 26 July, 2018

Sub EA_OnImportTechnology (Repository AsEA.Repository, Info As EA.EventProperties)

The EA_OnImportTechnology function syntax containsthese parameters.

Parameter Type

Info EA.EventPropertiesDirection: INDescription: Contains theseEventProperty objects:

TechnologyID: A string value·

corresponding to the MDG TechnologyID

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

(c) Sparx Systems 2018 Page 814 of 885

User Guide - Automation 26 July, 2018

None.

(c) Sparx Systems 2018 Page 815 of 885

User Guide - Automation 26 July, 2018

Custom Views

Enterprise Architect enables custom windows to be insertedas a Diagram Tab within the Diagram View that appears atthe center of the Enterprise Architect frame.

Creating a custom view helps you to easily display a custominterface within Enterprise Architect, alongside otherdiagrams and built-in views for quick and easy access.

Uses for this facility include:

Reports and graphs showing summary data of the model·

Alternative views of a diagram·

Alternative views of the model·

Views of external data related to model data·

Documentation tools·

(c) Sparx Systems 2018 Page 816 of 885

User Guide - Automation 26 July, 2018

Create a Custom View

A custom view must be designed as an ActiveX CustomControl and inserted via the Automation Interface. ActiveXCustom Controls can be created using most well-knownprogramming tools, including Microsoft Visual Studio. Seethe documentation provided by the relevant vendor on howto create a custom control to produce an OCX file.

Once the custom control has been created and registered onthe target system, it can be added through the AddTab()method of the Repository object. While it is possible to callAddTab() from any automation client, it is likely that youwould call it from an Add-In, and that the Add-In is definedin the same OCX that provides the custom view.

This is a C# code example:

public class Addin

{

UserControl1 m_MyControl;

public void EA_Connect(EA.Repository Rep)

{

}

public object EA_GetMenuItems(EA.RepositoryRepository, string Location, string MenuName)

{

if(MenuName == "")

return "-&C# Control Demo";

(c) Sparx Systems 2018 Page 817 of 885

User Guide - Automation 26 July, 2018

else

{

String() ret = {"Show Custom View", "ShowButton"};

return ret;

}

}

public void EA_MenuClick(EA.Repository Rep,string Location, string MenuName, string ItemName)

{

if(ItemName == "Show Custom View")

m_MyControl = (UserControl1)Rep.AddTab("C# Demo","ContDemo.UserControl1");

else if(ItemName == "Show Button")

m_MyControl.ShowButton();

}

}

(c) Sparx Systems 2018 Page 818 of 885

User Guide - Automation 26 July, 2018

Add a Portal

Enterprise Architect provides a set of Portals, each of whichis a collection of shortcuts and information on performingspecific areas of work on a project. The Portals help bothnew and experienced users quickly identify and set up thefacilities they most often use in their assigned tasks.

You can add your own Portal to the system-installed set, toprovide a convenient and concise call-up of one or moregroups of facilities available in your Add-In.

Example Code

public String EA_LoadWindowManager(EA.RepositoryRepository)

{

return Resource1.WindowManager;

}

Where Resource1.WindowManager is a resource file withthese contents:

<?xml version="1.0" encoding="UTF-8"?>

<perspectives>

<perspective name="Add-in">

<category name="Add-in" type="commandlist"projectrequired="true">

<item name="Hello World" command="CallAddin"

(c) Sparx Systems 2018 Page 819 of 885

User Guide - Automation 26 July, 2018

addin="CS_AddinFramework" function="HelloWorld"/>

<item name="Model Dump" command="CallScript"group="Local Scripts" script="JScript - Recursive ModelDump Example"/>

</category>

<category name="Open Diagrams"type="currentdiagramlist" state = "open"/>

<category name="Recent Diagrams"type="recentdiagramlist" state = "open"/>

<category name="Other Windows"type="otherwindowlist" state = "open"/>

</perspective>

</perspectives>

Note that the Add-In cannot specify the icon used.

(c) Sparx Systems 2018 Page 820 of 885

User Guide - Automation 26 July, 2018

Custom Docked Window

Custom docked windows can be added into the EnterpriseArchitect user interface. Once added, they can be shown anddocked in the same way as other built-in EnterpriseArchitect docked windows.

A custom docked window must be designed as an ActiveXCustom Control and inserted via the Automation Interface.ActiveX Custom Controls can be created using mostwell-known programming tools, including Microsoft VisualStudio. See the documentation provided by the relevantvendor on how to create a custom control to produce anOCX file.

Once the custom control has been created and registered onthe target system, it can be added using the AddWindow()method of the Repository object. While it is possible to callAddWindow() from any automation client, it is likely thatyou would call it from an Add-In, and that the Add-In isdefined in the same OCX that provides the custom view.

To view custom docked windows that have been added,select the 'Specialize > Add-Ins > Windows' ribbon option.

Custom docked windows can also be made visible by theautomation client or Add-in using the ShowAddinWindow()method, or hidden by using the HideAddinWindow()method.

This is an example in C# code:

public class Addin

(c) Sparx Systems 2018 Page 821 of 885

User Guide - Automation 26 July, 2018

{

UserControl1 m_MyControl;

public void EA_Connect(EA.Repository Rep)

{

m_MyControl = (UserControl1)Rep.AddWindow

("C# Demo","ContDemo.UserControl1");

}

public object EA_GetMenuItems(EA.RepositoryRepository, string Location, string MenuName)

{

if(MenuName == "")

return "-&C# Control Demo";

else

{

String() ret = {"Show Window", "ShowButton"};

return ret;

}

}

public void EA_MenuClick(EA.Repository Rep,string Location, string MenuName, string ItemName)

{

if(ItemName == "Show Window")

Rep.ShowAddinWindow("C# Demo");

(c) Sparx Systems 2018 Page 822 of 885

User Guide - Automation 26 July, 2018

else if(ItemName == "Show Button")

m_MyControl.ShowButton();

}

}

(c) Sparx Systems 2018 Page 823 of 885

User Guide - Automation 26 July, 2018

MDG Add-Ins

MDG Add-Ins are specialized types of Add-Ins that haveadditional features and extra requirements, for Add-Inauthors who want to contribute to Enterprise Architect's goalof Model Driven Generation. Two examples of MDGAdd-Ins are the MDG Link for Eclipse and MDG Link forVisual Studio, both integrated with the Enterprise Architectinstaller.

One of the additional responsibilities of an MDG Add-In isto take ownership of a branch of an Enterprise Architectmodel, which is done through the MDG_Connect event.Unlike general Add-In events, MDG Add-In events are onlysent to the Add-In that has taken ownership of an EnterpriseArchitect model branch on a particular workstation.

MDG Add-Ins identify themselves as such duringEA_Connect by returning the string 'MDG'.

Unlike ordinary Add-Ins, responding to MDG Add-Inevents is not optional, and methods must be published foreach of the MDG Events.

(c) Sparx Systems 2018 Page 824 of 885

User Guide - Automation 26 July, 2018

MDG Events

An MDG Add-In must respond to all MDG Events. Theseevents usually identify processes such as Build, Run,Synchronize, PreMerge and PostMerge, amongst others.

An MDG Link Add-In is expected to implement some formof forward and reverse engineering capability withinEnterprise Architect, and as such requires access to aspecific set of events, all to do with generation,synchronization and general processes concerned withconverting models to code and code to models.

MDGAdd-In Events

Event

MDG_BuildProject

MDG_Connect

MDG_Disconnect

MDG_GetConnectedPackages

MDG_GetProperty

MDG_Merge

(c) Sparx Systems 2018 Page 825 of 885

User Guide - Automation 26 July, 2018

MDG_NewClass

MDG_PostGenerate

MDG_PostMerge

MDG_PreGenerate

MDG_PreMerge

MDG_PreReverse

MDG_RunExe

MDG_View

(c) Sparx Systems 2018 Page 826 of 885

User Guide - Automation 26 July, 2018

MDG_Build Project

Add-Ins can use MDG_BuildProject to handle file changescaused by generation. This function is called in response toa user selecting the 'Execute > Run > Build > Build' ribbonoption.

Respond to this event by compiling the project source filesinto a running application.

Syntax

Sub MDG_BuildProject (Repository As EA.Repository,PackageGuid As String)

The MDG_BuildProject function syntax contains theseparameters.

Parameter Type

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository object

(c) Sparx Systems 2018 Page 827 of 885

User Guide - Automation 26 July, 2018

representing the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

None.

(c) Sparx Systems 2018 Page 828 of 885

User Guide - Automation 26 July, 2018

MDG_Connect

An Add-In uses MDG_Connect to handle a user drivenrequest to connect a model branch to an external application.The function is called when the user attempts to connect aparticular Enterprise Architect Package to an as yetunspecified external project. The Add-In calls the event tointeract with the user to specify such a project.

The Add-In is responsible for retaining the connectiondetails, which should be stored on a per-user orper-workstation basis. That is, users who share a commonEnterprise Architect model over a network should be able toconnect and disconnect to external projects independently ofone another.

The Add-In should therefore not store connection details inan Enterprise Architect repository. A suitable place to storesuch details would be:

SHGetFolderPath(..CSIDL_APPDATA..)\AddinName

The PackageGuid parameter is the same identifier as isrequired for most events relating to the MDG Add-In.Therefore it is recommended that the connection details beindexed using the PackageGuid value.

The PackageID parameter is provided to aid fast retrieval ofPackage details from Enterprise Architect, should this berequired.

Syntax

(c) Sparx Systems 2018 Page 829 of 885

User Guide - Automation 26 July, 2018

Function MDG_Connect (Repository As EA.Repository,PackageID as Long, PackageGuid As String) As Long

The MDG_Connect function syntax contains theseparameters.

Parameter Type

PackageGuid StringDirection: INDescription: The unique ID identifyingthe project provided by the Add-In whena connection to a project branch of anEnterprise Architect model was firstestablished.

PackageID LongDirection: INDescription: The PackageID of theEnterprise Architect Package the user hasrequested to have connected to anexternal project.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interface

(c) Sparx Systems 2018 Page 830 of 885

User Guide - Automation 26 July, 2018

status information.

Return Value

Returns a non-zero to indicate that a connection has beenmade; a zero indicates that the user has not nominated aproject and connection should not proceed.

(c) Sparx Systems 2018 Page 831 of 885

User Guide - Automation 26 July, 2018

MDG_Disconnect

Add-Ins can use MDG_Disconnect to respond to userrequests to disconnect the model branch from an externalproject.

This function is called when the user attempts to disconnectan associated external project. The Add-In is required todelete the details of the connection.

Syntax

Function MDG_Disconnect (Repository As EA.Repository,PackageGuid As String) As Long

The MDG_Disconnect function syntax contains theseparameters.

Parameter Type

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository object

(c) Sparx Systems 2018 Page 832 of 885

User Guide - Automation 26 July, 2018

representing the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Returns a non-zero to indicate that a disconnection hasoccurred enabling Enterprise Architect to update the userinterface. A zero indicates that the user has not disconnectedfrom an external project.

(c) Sparx Systems 2018 Page 833 of 885

User Guide - Automation 26 July, 2018

MDG_GetConnectedPackages

Add-Ins can use MDG_GetConnectedPackages to return alist of current connections between Enterprise Architect andan external application.

This function is called when the Add-In is first loaded, andis expected to return a list of the available connections toexternal projects for this Add-In.

Syntax

Function MDG_GetConnectedPackages (Repository AsEA.Repository) As Variant

The MDG_GetConnectedPackages function syntax containsthis parameter.

Parameter Type

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 834 of 885

User Guide - Automation 26 July, 2018

Return Value

Returns an array of GUID strings representing individualEnterprise Architect Packages.

(c) Sparx Systems 2018 Page 835 of 885

User Guide - Automation 26 July, 2018

MDG_GetProperty

MDG_GetProperty provides miscellaneous Add-In detailsto Enterprise Architect.

This function is called by Enterprise Architect to poll theAdd-In for information relating to the PropertyName. Thisevent should occur in as short a duration as possible, asEnterprise Architect does not cache the informationprovided by the function.

Values corresponding to these PropertyNames must beprovided:

IconID - Return the name of a DLL and a resource·

identifier in the format #ResID, where the resource IDindicates an icon c:\program files\myapp\myapp.dlll#101

Language - Return the default language that Classes·

should be assigned when they are created in EnterpriseArchitect

HiddenMenus - Return one or more values from the·

MDGMenus enumeration to hide menus that do not applyto your Add-In if(PropertyName == "HiddenMenus")

return mgBuildProject + mgRun;

Syntax

Function MDG_GetProperty (Repository As EA.Repository,

(c) Sparx Systems 2018 Page 836 of 885

User Guide - Automation 26 July, 2018

PackageGuid As String, PropertyName As String) AsVariant

The MDG_GetProperty function syntax contains theseparameters.

Parameter Type

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-treethat is controlled by the Add-In.

PropertyName

StringDirection: INDescription: The name of the propertythat is used by Enterprise Architect. Seeabove for the possible values.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently-openEnterprise Architect model. Poll itsmembers to retrieve model data and userinterface status information.

(c) Sparx Systems 2018 Page 837 of 885

User Guide - Automation 26 July, 2018

Return Value

See above.

(c) Sparx Systems 2018 Page 838 of 885

User Guide - Automation 26 July, 2018

MDG_Merge

Add-Ins can use MDG_Merge to jointly handle changes toboth the model branch and the code project that the modelbranch is connected to.

This event should be called whenever the user has asked tomerge their model branch with its connected code project, orwhenever the user has established a new connection to acode project.

The purpose of this event is to make the Add-In interactwith the user to perform a merge between the model branchand the connected project.

Syntax

Function MDG_Merge (Repository As EA.Repository,PackageGuid As String, SynchObjects As Variant,SynchType As String, ExportObjects As Variant,ExportFiles As Variant, ImportFiles As Variant,IgnoreLocked As String, Language As String) As Long

The MDG_Merge function syntax contains theseparameters.

Parameter Type

ExportFiles VariantDirection: OUTDescription: A string array containing the

(c) Sparx Systems 2018 Page 839 of 885

User Guide - Automation 26 July, 2018

list of files for each model object chosenfor export by the Add-In.Each entry in this array must have acorresponding entry in the ExportObjectsparameter at the same array index, soExportFiles(2) must contain the filenameof the object by ExportObjects(2).

ExportObjects

VariantDirection: OUTDescription: The string array containingthe list of new model objects (in ObjectID format) to be exported by EnterpriseArchitect to the code project.

IgnoreLocked

StringDirection: OUTDescription: A value indicating whetherto ignore any files locked by the codeproject (that is, 'True' or False').

ImportFiles VariantDirection: OUTDescription: A string array containing thelist of code files made available to thecode project to be newly imported to themodel.Enterprise Architect imports each file

(c) Sparx Systems 2018 Page 840 of 885

User Guide - Automation 26 July, 2018

listed in this array for import into theconnected model branch.

Language StringDirection: OUTDescription: The string value containingthe name of the code language supportedby the code project connected to themodel branch.

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

SynchObjects VariantDirection: OUTDescription: A string array containing alist of objects (Object ID format) to be

(c) Sparx Systems 2018 Page 841 of 885

User Guide - Automation 26 July, 2018

jointly synchronized between the modelbranch and the project.See Object ID Format for the format ofthe Object IDs.

SynchType StringDirection: OUTDescription: The value determining theuser-selected type of synchronization totake place.See Synchronize Type for a list of validvalues.

Object ID Format

Each of the Object IDs listed in the 'SynchObjects' stringarrays should have this format:

(@namespace)*(#class)*($attribute|%operation|:property)*

Return Value

Return a non-zero if the merge operation completedsuccessfully and a zero value when the operation has beenunsuccessful.

(c) Sparx Systems 2018 Page 842 of 885

User Guide - Automation 26 July, 2018

Merge

A merge consists of three major operations:

Export: where newly created model objects are exported·

into code and made available to the code project

Import: where newly created code objects, Classes and·

such things are imported into the model

Synchronize: where objects available both to the model·

and in code are jointly updated to reflect changes made ineither the model, code project or both

Synchronize Type

The Synchronize operation can take place in one of fourdifferent ways. Each of these ways corresponds to a valuereturned by 'SynchType':

None: (SynchType' = 0) No synchronization is to be·

performed

Forward: ('SynchType' = 1) Forward synchronization,·

between the model branch and the code project is to occur

Reverse: ('SynchType = 2) Reverse synchronization,·

between the code project and the model branch is to occur

Both: ('SynchType' = 3) Reverse, then Forward·

synchronizations are to occur

(c) Sparx Systems 2018 Page 843 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 844 of 885

User Guide - Automation 26 July, 2018

MDG_NewClass

Add-Ins can use MDG_NewClass to alter details of a Classbefore it is created.

This method is called when Enterprise Architect generates anew Class, and requires information relating to assigning thelanguage and file path. The file path should be passed backas a return value and the language should be passed back viathe language parameter.

Syntax

Function MDG_NewClass (Repository As EA.Repository,PackageGuid As String, CodeID As String, Language AsString) As String

The MDG_NewClass function syntax contains theseparameters.

Parameter Type

CodeID StringDirection: INDescription: A string used to identify thecode element before it is created.

Language StringDirection: OUT

(c) Sparx Systems 2018 Page 845 of 885

User Guide - Automation 26 July, 2018

Description: A string used to identify theprogramming language for the new Class.The language must be supported byEnterprise Architect.

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Returns a string containing the file path that should beassigned to the Class.

(c) Sparx Systems 2018 Page 846 of 885

User Guide - Automation 26 July, 2018

MDG_PostGenerate

Add-Ins can use MDG_PostGenerate to handle file changescaused by generation.

This event is called after Enterprise Architect has preparedtext to replace the existing contents of a file. Responding tothis event enables the Add-In to write to the linkedapplication's user interface rather than modify the filedirectly.

When the contents of a file are changed, EnterpriseArchitect passes FileContents as a non-empty string. Newfiles created as a result of code generation are also sentthrough this mechanism, so the Add-Ins can add new files tothe linked project's file list.

When new files are created Enterprise Architect passesFileContents as an empty string. When a non-zero isreturned by this function, the Add-In has successfullywritten the contents of the file. A zero value for the returnindicates to Enterprise Architect that the file must be saved.

Syntax

Function MDG_PostGenerate (Repository AsEA.Repository, PackageGuid As String, FilePath As String,FileContents As String) As Long

The MDG_PostGenerate function syntax contains theseparameters.

(c) Sparx Systems 2018 Page 847 of 885

User Guide - Automation 26 July, 2018

Parameter Type

FileContents StringDirection: INDescription: A string containing theproposed contents of the file.

FilePath StringDirection: INDescription: The path of the fileEnterprise Architect intends to overwrite.

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 848 of 885

User Guide - Automation 26 July, 2018

Return Value

The return value depends on the type of event that thisfunction is responding to (see introduction). This function isrequired to handle two separate and distinct cases.

(c) Sparx Systems 2018 Page 849 of 885

User Guide - Automation 26 July, 2018

MDG_PostMerge

MDG_PostMerge is called by Enterprise Architect after amerge process has been completed.

File save checking should not be performed with thisfunction, but should be handled by MDG_PreGenerate,MDG_PostGenerate and MDG_PreReverse.

Syntax

Function MDG_PostMerge (Repository As EA.Repository,PackageGuid As String) As Long

The MDG_PostMerge function syntax contains theseparameters.

Parameter Type

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open Enterprise

(c) Sparx Systems 2018 Page 850 of 885

User Guide - Automation 26 July, 2018

Architect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return a zero value if the post-merge process has failed. Anon-zero return indicates that the post-merge has beensuccessful. Enterprise Architect assumes a non-zero return ifthis method is not implemented.

(c) Sparx Systems 2018 Page 851 of 885

User Guide - Automation 26 July, 2018

MDG_PreGenerate

Add-Ins can use MDG_PreGenerate to deal with unsavedchanges.

This function is called immediately before EnterpriseArchitect attempts to generate files from the model. Apossible use of this function would be to prompt the user tosave unsaved source files.

Return Value

Return a zero value to abort generation. Any other valueenables the generation to continue.

Syntax

Function MDG_PreGenerate (Repository AsEA.Repository, PackageGuid As String) As Long

The MDG_PreGenerate function syntax contains theseparameters.

Parameter Type

PackageGuid StringDirection: INDescription: The GUID identifying the

(c) Sparx Systems 2018 Page 852 of 885

User Guide - Automation 26 July, 2018

Enterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 853 of 885

User Guide - Automation 26 July, 2018

MDG_PreMerge

MDG_PreMerge is called after a merge process has beeninitiated by the user and before Enterprise Architectperforms the merge process.

This event is called after a user has performed theirinteractions with the merge screen and has confirmed themerge with the OK button, but before Enterprise Architectperforms the merge process using the data provided by theMDG_Merge call, before any changes have been made tothe model or the connected project.

This event is made available to provide the Add-In with theopportunity to generally set internal Add-In flags toaugment the MDG_PreGenerate, MDG_PostGenerate andMDG_PreReverse events.

File save checking should not be performed with thisfunction, but should be handled by MDG_PreGenerate,MDG_PostGenerate and MDG_PreReverse.

Syntax

Function MDG_PreMerge (Repository As EA.Repository,PackageGuid As String) As Long

The MDG_PreMerge function syntax contains theseparameters.

Parameter Type

(c) Sparx Systems 2018 Page 854 of 885

User Guide - Automation 26 July, 2018

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model.Poll its members to retrieve model dataand user interface status information.

Return Value

A return value of zero indicates that the merge process cannot occur. If the value is not zero the merge processproceeds.

If this method is not implemented then it is assumed that amerge process is used.

(c) Sparx Systems 2018 Page 855 of 885

User Guide - Automation 26 July, 2018

MDG_PreReverse

Add-Ins can use MDG_PreReverse to save file changesbefore they are imported into Enterprise Architect.

This function operates on a list of files that are about to bereverse-engineered into Enterprise Architect. If the user isworking on unsaved versions of these files in an editor, youcould either prompt the user or save automatically.

Syntax

Sub MDG_PreReverse (Repository As EA.Repository,PackageGuid As String, FilePaths As Variant)

The MDG_PreReverse function syntax contains theseparameters.

Parameter Type

FilePaths String arrayDirection: INDescription: An array of filepaths pointedto the files that are to be reverseengineered.

PackageGuid StringDirection: INDescription: The GUID identifying the

(c) Sparx Systems 2018 Page 856 of 885

User Guide - Automation 26 July, 2018

Enterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

None.

(c) Sparx Systems 2018 Page 857 of 885

User Guide - Automation 26 July, 2018

MDG_RunExe

Add-Ins can use MDG_RunExe to run the targetapplication.

This function is called when the user selects the 'Execute >Run > Start > Run' ribbon option.

Respond to this event by launching the compiledapplication.

Return Value

None.

Syntax:

Sub MDG_RunExe (Repository As EA.Repository,PackageGuid As String)

The MDG_RunExe function syntax contains theseparameters.

Parameter Type

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-tree

(c) Sparx Systems 2018 Page 858 of 885

User Guide - Automation 26 July, 2018

that is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

(c) Sparx Systems 2018 Page 859 of 885

User Guide - Automation 26 July, 2018

MDG_View

Add-Ins can use MDG_View to display user specified codeelements.

This function is called by Enterprise Architect when the userasks to view a particular code element. The Add-In can thenpresent that element in its own way, usually in a code editor.

Syntax

Function MDG_View (Repository As EA.Repository,PackageGuid As String, CodeID as String) As Long

The MDG_View function syntax contains these parameters.

Parameter Type

CodeID StringDirection: INDescription: Identifies the code elementin this format:

<type>ElementPart<type>ElementPart...where each element is proceeded with atoken identifying its type: @ -namespace # - Class $ - attribute

(c) Sparx Systems 2018 Page 860 of 885

User Guide - Automation 26 July, 2018

% - operationFor example, if a user has selected them_Name attribute of Class1 located innamespace Name1, the Class ID wouldbe passed through in this format: @Name1#Class1%m_Name

PackageGuid StringDirection: INDescription: The GUID identifying theEnterprise Architect Package sub-treethat is controlled by the Add-In.

Repository EA.RepositoryDirection: INDescription: An EA.Repository objectrepresenting the currently open EnterpriseArchitect model. Poll its members toretrieve model data and user interfacestatus information.

Return Value

Return a non-zero value to indicate that the Add-In hasprocessed the request. Returning a zero value results inEnterprise Architect employing the standard viewing

(c) Sparx Systems 2018 Page 861 of 885

User Guide - Automation 26 July, 2018

process, which is to launch the associated source file.

(c) Sparx Systems 2018 Page 862 of 885

User Guide - Automation 26 July, 2018

Workflow Scripts

Workflow scripts validate user work and actions against thepolicy and procedures within your model, providing a robustapproach to applying company policy and strengtheningproject development guidelines.

Project Administrators can write workflow scripts tomanage the way users interact with a model, such asmanaging security, staff compliance and model access, andmonitoring changes made by users. Administrators can alsouse the scripts to control a user's capacity to change a modelelement, taking into account factors such as access rights,group membership and even the value of a proposed change.

Access

Open the Scripting window using one of the methodsoutlined here, then click on the New Group button to createa new Workflow script group, before clicking on the NewScript button to create a new script.

Ribbon Specialize > Tools > Scripting

Application of Workflow scripts

(c) Sparx Systems 2018 Page 863 of 885

User Guide - Automation 26 July, 2018

Consideration

Description

ProjectGovernance

Good corporate governance relies on wellwritten and transparent projectdevelopment guidelines and companypolicy.A project might be compromised if theappropriate policies and procedures arepoorly understood and not followedcorrectly - effective governance can behampered by human error and the costsof recovering from the inadequatecompliance of developers.

Policies,ProceduresandDevelopment

Company policy and procedures can beintegrated with the development processto manage workflows, determine accessrights, extend role based securitypermissions and respond to propertychange events.This approach reduces compliance costs,enhances collaborative development andgives you confidence that projects arebeing developed correctly the first timearound.Development teams can adhere to bestpractice guidelines that govern modelvalidation, change management, access

(c) Sparx Systems 2018 Page 864 of 885

User Guide - Automation 26 July, 2018

controls and general developmentprinciples.

ScriptImplementation

When a model is launched, the WorkflowEngine is initialized with the current userand group memberships; this informationdetermines who can access and modifyparts of a given model.When a selected event occurs, the scriptengine is initialized with values includingthe author's name and access rights, andthe element name and version details.The workflow script implements rulesgoverning change management, accesscontrol and model validation; if a userattempts to make changes in violation ofcompany policy, the script denies theupdate.The user is notified why the validationfailed and the activity is logged.These reminders help to reinforcecompany policy, reduce human error andprovide management with valuableproject feedback.

Notes

(c) Sparx Systems 2018 Page 865 of 885

User Guide - Automation 26 July, 2018

Workflow Scripting is available in the Corporate,Unified·

and Ultimate editions of Enterprise Architect

Workflow Scripting requires User Security to be enabled·

in order to function

You need 'Admin Workflow' permission to develop and·

manage workflow scripts

(c) Sparx Systems 2018 Page 866 of 885

User Guide - Automation 26 July, 2018

Workflow Script Functions

Workflow scripts are created in the Scripting window, underthe Workflow group type as VBScripts. They are executedby the Enterprise Architect workflow engine, to manageuser input.

You can make use of a range of functions and datastructures to develop your scripts.

Access

Ribbon Specialize > Tools > Scripting

Workflow functions and data structures

Function Description

Functions forUser Input

These are functions that EnterpriseArchitect calls to validate and controluser input.For each of the functions that EnterpriseArchitect calls, a set of objects are filled.

(c) Sparx Systems 2018 Page 867 of 885

User Guide - Automation 26 July, 2018

Functions tocreate aSearch

These are functions that EnterpriseArchitect calls to create a search withuser tasks.

WorkflowDataStructuresEnterpriseArchitect fills

These are workflow data structure objectsthat Enterprise Architect fills.

WorkflowDataStructuresyou fill

These are Workflow data structureobjects that you can fill.

Functionsyou call

These are functions that EnterpriseArchitect provides for you to call.

Notes

If you make changes to a workflow script listed in the·

Scripting window, click on the Refresh Scripts button inthe Scripting window toolbar to reload the script with thechanges

(c) Sparx Systems 2018 Page 868 of 885

User Guide - Automation 26 July, 2018

Functions - Validate and Control UserInput

Enterprise Architect calls a number of functions to validateand control user input. For each function a set of objects isfilled.

Validate/Control User Input

Function Action

AllowPhaseUpdate(OldValue,NewValue)

Validate a change a user has made to aphase.Return Value:

True to allow this user to make this·

changeFalse to disallow the change and revert·

to the previous value

AllowStatusUpdate(OldValue,NewValue)

Validate a change a user has made to astatus.Return Value:

True to allow this user to make this·

changeFalse to disallow the change and revert·

to the previous value

(c) Sparx Systems 2018 Page 869 of 885

User Guide - Automation 26 July, 2018

AllowTagUpdate(TagName,OldValue,NewValue)

Validate a change a user has made to aTagged Value.Return Value:

True to allow this user to make this·

changeFalse to disallow the change and revert·

to the previous value

AllowVersionUpdate(OldValue,NewValue)

Validate a change a user has made to aversion.Return Value:

True to allow this user to make this·

changeFalse to disallow the change and revert·

to the previous value

CanEditPhase()

Enable or disable the control for editing aphaseReturn Value:

True to allow this user to make changes·

by enabling the controlFalse to completely disable edit of this·

property by disabling the control

CanEditStatus()

Enable or disable the control for editing astatus.Return Value:

(c) Sparx Systems 2018 Page 870 of 885

User Guide - Automation 26 July, 2018

True to allow this user to make changes·

by enabling the controlFalse to completely disable edit of this·

property by disabling the control

CanEditTag(TagName)

Enable or disable the control for editing aTagged Value.Return Value:

True to allow this user to make changes·

by enabling the controlFalse to completely disable edit of this·

property by disabling the control

CanEditVersion()

Enable or disable the control for editing aversion.Return Value:

True to allow this user to make changes·

by enabling the controlFalse to completely disable edit of this·

property by disabling the control

OnPreNewElement(ElementType,ElementStereotype)

Allow or disallow the creation of thespecified element.Return Value:

True to allow this user to create the·

element/connectorFalse to prevent this user from creating·

the element

(c) Sparx Systems 2018 Page 871 of 885

User Guide - Automation 26 July, 2018

OnPreNewConnector(ConnectorType,ConnectorSubType,ConnectorStereotype)

Allow or disallow the creation of thespecified connector.Return Value:

True to allow this user to create the·

element/connectorFalse to prevent this user from creating·

the element

PreAllowPhaseUpdate(OldValue,NewValue)

Determine what information is requiredto validate this change.Return Value: Semi-colon separated listof additional data required in order tovalidate this change.Supported Data Type:

Tests - fill the Tests array in the·

WorkflowContext object

PreAllowStatusUpdate(OldValue,NewValue)

Determine what information is requiredto validate this change.Return Value: Semi-colon separated listof additional data required in order tovalidate this change.Supported Data Type:Tests - fill the Tests array in theWorkflowContext object

PreAllowTag Determine what information is required

(c) Sparx Systems 2018 Page 872 of 885

User Guide - Automation 26 July, 2018

Update(TagName,OldValue,NewValue)

to validate this change.Return Value: Semi-colon separated listof additional data required in order tovalidate this change.Supported Data Type:Tests - fill the Tests array in theWorkflowContext object

PreAllowVersionUpdate(OldValue,NewValue)

Determine what information is requiredto validate this change.Return Value: Semi-colon separated listof additional data required in order tovalidate this change.Supported Data Type:Tests - fill the Tests array in theWorkflowContext object

(c) Sparx Systems 2018 Page 873 of 885

User Guide - Automation 26 July, 2018

Functions - Create a Search With UserTasks

These are functions that Enterprise Architect calls to createa search with user tasks.

Functions

Function Action

GetWorkflowTasks

Describe the searches that this user mustrun.Return Value: Ignored

(c) Sparx Systems 2018 Page 874 of 885

User Guide - Automation 26 July, 2018

Filled Workflow Data Structures

These are the workflow data structures (objects) thatEnterprise Architect fills.

Data Structures

WorkflowDataStructure

Description

WorkflowUser

This object provides information aboutthe user currently logged in to the model.It is filled by Enterprise Architect beforeany function is called by EnterpriseArchitect; it has these properties:

Username - the username for login to·

the system (if using WindowsAuthentication, this matches theWindows username)Firstname - as found in the 'Security·

Users' dialogSurname - as found in the 'Security·

Users' dialogFullname - the combination·

<Firstname> <Surname> (the formEnterprise Architect uses for 'Author'

(c) Sparx Systems 2018 Page 875 of 885

User Guide - Automation 26 July, 2018

fields and similar)Department - the department in which·

the user works, as found in the'Security Users' dialog

Calls: This object calls theIsMemberOf(GroupName) function.

WorkflowContext

This object provides information aboutthe object currently in context.It is filled by Enterprise Architect beforeany searches except GetWorkflowTasksare run; it has these properties:

MetaType - the type of the current·

object, either an Enterprise Architectcore type or a profile-specifiedmetatypeName - as found in the object·

'Properties' dialogStatus - as found in the object·

'Properties' dialogPhase - as found in the object·

'Properties' dialogVersion - as found in the object·

'Properties' dialogStereotypes - an array of strings for the·

stereotypes applied to this objectTags - an array of Tagged Values,·

providing:

(c) Sparx Systems 2018 Page 876 of 885

User Guide - Automation 26 July, 2018

- Name - the Tagged Value name - Value - the Tagged Value valueTests - an array of tests; only filled·

during an Allow* call after thePreAllow* call has specified that testsare required; provides these details, asfound in the Testing window: - Name - Status - RunBy - CheckedBy - TestClass - TestType

Calls: This object calls theTagValue(TagName) function.

Functions

Function Action

IsMemberOf(GroupName)

Check the group membership of thecurrent user.Return Value: Returns the value True ifthe current user is a member of the groupwith the specified name.

(c) Sparx Systems 2018 Page 877 of 885

User Guide - Automation 26 July, 2018

TagValue(TagName)

Get the value from a named tag.Return Value: Returns the value of thefirst Tagged Value with that name, or anempty string if no Tagged Value with thatname exists.

(c) Sparx Systems 2018 Page 878 of 885

User Guide - Automation 26 July, 2018

Workflow Data Structures You Fill

These are the workflow data structures (objects) that youcan fill.

Data Structures

WorkflowDataStructure

Description

WorkflowStatus

Use this data structure to provideinformation on the status of the object.

LogEntry - set to True or False to·

indicate whether or not a log itemshould be recordedReason - indicate what reason should·

be recorded in the logAction - indicate how to display the log·

message; valid values are:MessageBox, StatusBar and Output(default)

WorkflowSearches

Use this data structure to provide an arrayof searches.Use Redim WorkflowSearches(x) tospecify the number of searches being

(c) Sparx Systems 2018 Page 879 of 885

User Guide - Automation 26 July, 2018

provided.Each search has these attributes:

Name - the name of this search·

Group - the name of the group that this·

search should appear under in the'Search' combo boxID - the GUID for this search·

Tasks - the array of tasks that this·

search looks for; an entry describeshow to find all objects required to meeta particular task: - Name - the name of the task, asdisplayed in the Model Search view; workflow searches aregrouped by this field by default - Conditions - an array of conditions,all of which must be matched for an object to be included in thistask; a condition is a comparison of a single field to a value: - Column - the name of the field - Operator - operator types,either = (provide matching values only) or <> (provide non-matchingvalues only) - Value - if this contains acomma, the string is treated as a comma separated list ofvalues to compare against;

(c) Sparx Systems 2018 Page 880 of 885

User Guide - Automation 26 July, 2018

otherwise the string is a singlevalue to compare against

(c) Sparx Systems 2018 Page 881 of 885

User Guide - Automation 26 July, 2018

Functions You Call

These are functions that Enterprise Architect provides foryou to call.

Functions

Function Action

NewSearch(name, group,guid,taskcount)

Create a new search object to be includedin WorkflowSearches.Initialize each member.Return Value: The created search

NewTask(name,conditioncount)

Create a new task object to be included ina search.Initialize each member.Return Value: The created task

NewCondition(column,operator,value)

Create a new condition object to beincluded in a task.Initialize each member.Return Value: The created condition

SetLastError(message,

Called on user input to these elementproperties:

(c) Sparx Systems 2018 Page 882 of 885

User Guide - Automation 26 July, 2018

outputMethod)

Status·

Phase·

Version, and·

Tagged Values·

It logs and/or reports the providedmessage to the user. It can be calledwithin the functions:

AllowPhaseUpdate·

AllowStatusUpdate·

AllowTagUpdate·

AllowVersionUpdate·

preAllowPhaseUpdate·

preAllowStatusUpdate·

preAllowTagUpdate·

preAllowVersionUpdate·

For example: public functionAllowPhaseUpdate(OldValue,NewValue) AllowPhaseUpdate = false SetLastError "No updating to phaseallowed", "messagebox" end functionParameters:

message: Text·

(c) Sparx Systems 2018 Page 883 of 885

User Guide - Automation 26 July, 2018

outputMethod: can be "messagebox",·

"statusbar" or "outputwindow"; thisparameter is case sensitive

Return Value: The message

(c) Sparx Systems 2018 Page 884 of 885

User Guide - Automation 26 July, 2018

(c) Sparx Systems 2018 Page 885 of 885