Book a Demo

Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Prev Next

Repository Class

The Repository is the main container of all structures such as models, Packages and elements. You can begin accessing the model iteratively using the Models collection. The Repository also has some convenient methods to directly access the structures without having to locate them in the hierarchy first.

Associated table in .EAP file

<none>

Repository Attributes

Attribute

Remarks

See also

Authors

Collection

Notes: Read only

This is the system Authors collection containing 0 or more Author objects, each of which can be associated with, for example, elements or diagrams as the item author or owner.

Use AddNew(), Delete() and GetAt() to manage Authors.

Collection Class

BatchAppend

Boolean

Notes: Read/Write

Set this property to True when your automation client has to rapidly insert many elements, operations, attributes and/or operation parameters.

Set to False when work is complete.

This can result in 10- to 20-fold improvement in adding new elements in bulk.

Clients

Collection

Notes: Read only

A list of Clients associated with the project. You can modify, delete and add new Client objects using this collection.

Collection Class

ConnectionString

String

Notes: Read only

The filename/connection string of the current Repository.

For a connection string, the DBMS repository type is identified by "DBType=n;" where n is a number corresponding to the DBMS type, as shown:

0 - MYSQL

1 - SQLSVR

2 - ADOJET

3 - ORACLE

4 - POSTGRES

5 - ASA 

8 - ACCESS2007

9 - FIREBIRD

CurrentSelection

Notes: Read only

Provides information on what is selected, and in what location without making any requests to the database.

EASelection Class

DataMinerManager

Data Miner object

Notes: Returns a pointer to the EA.DataMinerManager interface.

DataMinerManager Class

Datatypes

Collection

Notes: Read only

The Datatypes collection. This contains a list of Datatype objects, each representing a data type definition for either data modeling or code generation purposes.

Collection Class

EAEdition

EAEditionTypes

Notes: Read only

Returns the current level of core licensed functionality available.

This property returns Corporate when the edition is Unified or Ultimate.

Use 'EAEditionEx' to identify which of these extended editions is available.

EAEditionTypes

EAEditionEx

EAEditionTypes

Notes: Read only

Returns the current level of extended licensed functionality available (Unified or Ultimate).

EAEditionTypes

EnableCache

Boolean

Notes: Read/Write

An optimization for pre-loading Package objects when dealing with large sets of automation objects.

EnableUIUpdates

Boolean

Notes: Read/Write

Set this property to False to improve the performance of changes to the model; for example, bulk addition of elements to a Package. To reveal changes to the user, call 'Repository.RefreshModelView()'.

FlagUpdate

Boolean

Notes: Read/Write

Instructs Enterprise Architect to update the Repository with the LastUpdate value.

InstanceGUID

String

Notes: Read only

The identifier string identifying the Enterprise Architect runtime session.

IsSecurityEnabled

Boolean

Notes: Read only

Indicates whether User Security is enabled for the current repository.

Issues

Collection

Notes: Read only

The System Issues list. Contains ProjectIssues objects, each detailing a particular issue as it relates to the project as a whole.

Collection Class

LastUpdate

String

Notes: Read only

The identifier string identifying the Enterprise Architect runtime session and the timestamp for when it was set.

LibraryVersion

Long

Notes: Read only

The build number of the Enterprise Architect runtime.

Models

Collection of type Package

Notes: Read only

Models are of type Package and belong to a collection of Packages. This is the top level entry point to an Enterprise Architect project file. Each model is a root node in the Browser window and can contain items such as Views and Packages.

A model is a special form of a Package; it has a ParentID of 0. By iterating through all models, you can access all the elements within the project hierarchy.

You can also use the AddNew() function to create a new model. A model can be deleted, but remember that everything contained in the model is deleted as well.

Collection Class Package Class

ObjectType

ObjectType

Notes: Read only

Distinguishes objects referenced through the Dispatch interface.

ObjectType

ProjectGUID

String

Notes: Read only

Returns the unique ID for the project.

ProjectRoles

Collection

Notes: Read only

The system Roles collection containing 0 or more Role objects, each of which can be associated with, for example, elements or diagrams as the item author or owner.

Use AddNew(), Delete() and GetAt() to manage Roles.

Collection Class

PropertyTypes

Collection

Notes: Read only

Collection of Property Types available to the Repository.

Collection Class PropertyType Class

Resources

Collection

Notes: Read only

Contains available ProjectResource objects to assign to work items within the project.

Use the 'Add New()', 'Modify()' and 'Delete()' functions to manage resources.

Collection Class

SearchWindow

Notes: Read only

Returns a reference to the Enterprise Architect Search Window.

SearchWindow Class

SecurityUser

Notes: Read only

Provides information about the currently logged in security user.

SecurityUser Class

Stereotypes

Collection

Notes: Read only

The Stereotype collection. A list of Stereotype objects that contain information on a stereotype and the elements it can be applied to.

Collection Class Stereotype Class

SuppressEADialogs

Boolean

Notes: Read/Write

Set this property in the EA_OnPostNewElement broadcast event to control whether Enterprise Architect should suppress showing the default 'Properties' dialog to the user when an element is created.

EA_OnPostNewElement

SuppressSecurityDialog

Boolean

Notes: Read/Write

Suppress the login prompt dialog that appears by default when username and password parameters passed to OpenFile2 are invalid. For use by external automation clients only.

Tasks

Collection

Notes: Read only

A list of system tasks (to do list). Each entry is a Task Item; you can modify, delete and add new tasks.

Collection Class Task Class

Terms

Collection

Notes: Read only

The Project Glossary Terms. Each Term object is an entry in the Glossary. Add, modify and delete Terms to maintain the Glossary.

Collection Class Term Class

Repository Methods

Method

Remarks

See also

ActivateDiagram (long DiagramID)

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

Parameters:

  • DiagramID: Long - the ID of the diagram to make active

ActivatePerspective (string long)

Boolean

Notes: Deprecated - no longer in use.

ActivateTab (string Name)

Notes: Activates an open Enterprise Architect tabbed view.

Parameters:

  • Name: String - the name of the view to activate

ActivateTechnology (string TechnologyID)

Notes: Activates an enabled MDG Technology.

Parameters:

  • TechnologyID: String - the ID of the Technology to activate, as assigned in the MDG Technology Wizard
Create MDG Technology File

ActivateToolbox (string Toolbox, long Options)

Boolean

Notes: Activates a Toolbox page in the GUI.

The returned value is reserved for future use.

Parameters:

  • Toolbox: String - the name of the Toolbox page to activate
  • Options: Long - reserved for future use

AddDefinedSearches (string sXML)

Notes: Used to enter a set of defined searches that last in Enterprise Architect for the life of the application; when Enterprise Architect loads again they must be inserted again by your Add-In.

Parameters:

  • sXML: String - the XML of the defined searches; you can get this XML by performing an export of the searches from the 'Manage Searches' dialog in Enterprise Architect
Define & Modify Searches

AddDocumentationPath (string Name, string Path, long Type)

Notes: Provides an Add-In with the ability to insert a book path into the Enterprise Architect installation directory, to display Learning Center pages on user-authored subjects (such as use of the Add-In).

Parameters:

  • Name: String - the top-level (root) name for the Learning Center documentation hierarchy for the Add-In (for example, Enterprise Architect)
  • Path: String - the directory path to the folder to contain the Learning Center documentation structure (for example,
    C:\Program Files (86)\Sparx Systems\EA\Books
  • Type: Long - reserved for future use; set to 0
Learning Center Create Learning Center Pages

AddPerspective (string Perspective, long Options)

Boolean

Notes: Deprecated - no longer in use.

AddPropertiesTab (string TabName, string PropXML)

Notes: Create a Properties tab.

Returns a PropertiesTab interface if a tab was created successfully, otherwise NULL.

Parameters:

  • TabName: String - Name of the Properties tab
  • PropXML: String - An XML string defining the values in the tab

Example XML string.

<?xml version='1.0'?>

<properties>

  <group name='theGroup1'>

    <property id='1' type='text' default='' readonly='false' >

      <name>TestText</name>

      <description>this has id=1</description>

    </property>

    <property id='2' type='combobox' default='' readonly='false' >

      <name>TestCombo</name>

      <value>Two</value>

      <description>this has id=2</description>

      <valuelist>

        <item>One</item>

        <item>Two</item>

        <item>Three</item>

      </valuelist>

    </property>

    <property id='3' type='date' default='currentdate' showcheckbox='false' readonly='false' >

      <name>TestDate</name>

      <value></value>

      <description>this has id=3</description>

    </property>

    <property id='4' type='checkbox' default='true' readonly='false' >

      <name>TestCheckbox</name>

      <description>this has id=4</description>

    </property>

    <property id='5' type='spin' default='1' min='0' max='100' readonly='false' >

      <name>TestSpin</name>

      <value>7</value>

      <description>this has id=5</description>

    </property>

    <property id='6' type='int' default='1' readonly='false' >

      <name>TestInt</name>

      <value>100</value>

      <description>this has id=6</description>

    </property>

    <property id='7' type='double' default='1' readonly='false' >

      <name>TestDouble</name>

      <value>3.333</value>

      <description>this has id=7</description>

    </property>

    <property id='8' type='memo' default='' readonly='false' >

      <name>TestMemo</name>

      <value></value>

      <description>this has id=8</description>

    </property>

  </group>

  <group name='theGroup2'>

    <property id='22' type='text' default='' readonly='false' >

      <name>Test1</name>

      <value></value>

      <description>this has id=22</description>

      <valuelist>

        <item></item>

      </valuelist>

    </property>

  </group>

</properties>

PropertiesTab Class

AddTab (string TabName, string ControlID)

activeX custom control

Notes: Adds an ActiveX custom control as a tabbed window. Enterprise Architect creates a control and, if successful, returns its Unknown pointer, which can be used by the caller to manipulate the control.

Parameters:

  • TabName: String - used as the tab caption
  • ControlID: String - the ProgID of the control; for example, "CS_AddinFramework.UserControl1"
Create a Custom View

AddWindow (string WindowName, string ControlID)

activeX custom control

Notes: Adds an ActiveX custom control as a window to the Add-Ins docked window. Enterprise Architect creates a control and, if successful, returns its Unknown pointer, which can be used by the caller to manipulate the control.

Parameters:

  • WindowName: String - used as the window title
  • ControlID: String - the ProgID of the control; for example, "CS_AddinFramework.UserControl1"
Custom Docked Window

AdviseConnectorChange (long ConnectorID)

Notes: Provides an Add-In or automation client with the ability to advise the Enterprise Architect user interface that a particular connector has changed and, if it is visible in any open diagram, to reload and refresh that connector for the user.

Parameters:

  • ConnectorID: Long - the ID of the connector

AdviseElementChange (long ObjectID)

Notes: Provides an Add-In or automation client with the ability to advise the Enterprise Architect user interface that a particular element has changed and, if it is visible in any open diagram, to reload and refresh that element for the user.

Parameters:

  • ObjectID: Long - the ID of the element

CallSBPI (string sbpiPrefix, string Method, string packedParameters)

Notes: Returns a JSON string with the result from the external server.

Parameters:

  • sbpiPrefix: String - Prefix value of the external server
  • Method: String - Name of the function to call on the external server
  • packedParameters: String - The JOSN string to append the Name/Value to; cannot be empty

ChangeLoginUser (string Name, string Password)

Boolean

Notes: Sets the currently logged on user to be the one specified by a name and password; this logs the user into the repository 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 (Object StartDateTime, Object EndDateTime)

Boolean

Notes: Clears all Audit Logs from the model.

If StartDateTime and EndDateTime are not null then only log items that fall into this period are cleared.

Returns True for success, False for failure.

  • This method cannot be undone; it is strongly advised that you call 'SaveAuditLogs' first to backup the logs
  • This method might fail if the user logged into the model does not have the correct access permission

Parameters:

  • StartDateTime: Variant (DateTime) - the earliest date and time of log entries to clear
  • EndDateTime: Variant (DateTime) - the latest date and time of log entries to clear

ClearOutput (string Name)

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

Parameters:

  • Name: String - the name of the tab to remove text from

CloseAddins ()

Notes: Called by automation controllers to ensure that Add-Ins created in .NET do not linger after all controller references to Enterprise Architect have been cleared.

CloseDiagram (long DiagramID)

Notes: Closes a diagram in the current list of diagrams that Enterprise Architect has open.

Parameters:

  • DiagramID: Long - the ID of the diagram to close

CloseFile ()

Notes: Closes any open file.

CreateDocumentGenerator()

Document Generator

Notes: Returns a pointer to the EA.DocumentGenerator interface.

Document Generator Interface Package

CreateModel (CreateModelType CreateType, string FilePath, long ParentWnd)

Boolean

Notes: Creates a new .eap model file based on the standard Enterprise Architect Base model, or a shortcut .eap based on a provided SQL connection.

Returns True when the new file is created, otherwise returns False.

Parameters:

  • CreateType: CreateModelType - Specify whether to make a new copy of the EABase.eap model, or create a .eap file shortcut to a DBMS repository; the latter option requires a dialog to be opened for the user to provide SQL connection details
  • FilePath: String - Destination for new .eap file
  • ParentWnd: Long - Window handle to act as the parent for the 'SQL connection' dialog; only required when using cmEAPFromSQLRepository
CreateModelType

CreateOutputTab (string Name)

Notes: Creates a tab in the System Output window.

Parameters:

  • Name: String - the name of the tab to create

DeletePerspective (string Perspective, long Options)

Boolean

Notes: Deprecated - no longer in use.

DeleteTechnology (string ID)

Boolean

Notes: Removes a specified MDG Technology resource from the repository.

Returns True if the technology is successfully removed from the model. Returns False otherwise.

  • This applies to technologies imported into pre-7.0 versions of Enterprise Architect (imported technologies), not to technologies referenced in version 7.0 and later (referenced technologies)

Parameters:

  • ID: String - the ID of the technology
Deploy an MDG Technology

EnsureOutputVisible (string Name)

Notes: Checks that a specified tab in the System Output window is visible to the user. The System Output window is made visible if it is hidden.

Parameters:

  • Name: String - the name of the tab to make visible

ExecutePackageBuildScript (long ScriptOptions, string PackageGuid)

Notes: Helps you to run the active Package build script based on your current selection in the Browser window. You can also run a script by passing in the Package GUID.

Parameters:

  • ScriptOptions: Long - the script type; can be any one of these numerical values:

              1 = Build

              2 = Test

              3 = Run

              4 = Create Workbench Instance

              5 = Debug

  • PackageGuid: String - the ID of the Package for which to run the script

Exit

Notes: Shuts down Enterprise Architect immediately. Used by .NET programmers where the garbage collector does not immediately release all referenced COM objects.

ExtractImagesFromNote (string Notes, string WriteImagePath, string RelativeImagePath)

String

Notes: Writes any Image Manager links to the WriteImagePath directory.

Returns a modified notes text, which contains links to the images using the RelativeImagePath parameter.

Parameters:

  • Notes: String - the notes of the selected Package, diagram or element
  • WriteImagePath: String - the path where the image file links will be stored; this path must exist
  • RelativeImagePath: String - the path to be inserted into the modified string indicating where the images can be found (for example, "..\images\")

ExtractSBPIParameter (string packedParameters, string name)

Notes: Returns the value of the parameter name as a string.

Parameters:

  • packedParameters: String - The JOSN string to append the Name/Value to; cannot be empty
  • name: String - The name of the parameter

GenerateMDGTechnology (string Filename)

Boolean

Notes: Generates an MDG Technology file using the settings in the given MTS file.

The returned value indicates success or failure.

Parameters:

  • Filename: String - the name and path of the MTS file to use

GetActivePerspective ()

String

Notes: Deprecated - no longer in use.

GetAllDiagramImagesAndMap (string Directory)

Boolean

Notes : Saves the image and image-map for every diagram in the model, in the specified directory location.

The image files will be saved in PNG format and each will have the diagram GUID as the image name. The image-map files will be saved as TXT files and each will have the diagram GUID as the image map name.

The 'Auto Create Diagram Image and Image Map' option must be selected in the model options for this function to save the images and image-maps.

Parameters:

  • Directory – the location of the directory into which the images and image-maps are to be saved
Cloud Page

GetAttributeByGuid (string Guid)

Attribute

Notes: Returns a pointer to an attribute in the repository, located by its GUID. This is usually found using the AttributeGUID property of an attribute.

Parameters:

  • Guid: String - the GUID of the attribute to locate
Attribute Class

GetAttributeByID (string Id)

Attribute

Notes: Returns a pointer to an attribute in the repository, located by its ID. This is usually found using the AttributeID property of an attribute.

Parameters:

  • Id: String - the ID of the attribute to locate
Attribute Class

GetConnectorByGuid (string Guid)

Connector

Notes: Returns a pointer to a connector in the repository, located by its GUID. This is usually found using the ConnectorGUID property of a connector.

Parameters:

  • Guid: String - the GUID of the connector to locate
Connector Class

GetConnectorByID (long ConnectorID)

Connector

Notes: Searches the repository for a connector with a specific ID.

Parameters:

  • ConnectorID: Long - the ID of the connector to locate
Connector Class

GetContextItem (object Item)

ObjectType

Notes: Sets a pointer to an item in context within Enterprise Architect.

Also returns the corresponding ObjectType.

For additional information about ContextItems and the supported ObjectTypes see the 'GetContextItemType' method.

Parameters:

  • Item: Object - the item to point to
ObjectType

GetContextItemType ()

ObjectType

Notes: Returns the ObjectType of an item in context within Enterprise Architect. A ContextItem is defined as an item selected anywhere within the Enterprise Architect GUI including:

  • An item selected in the Browser window
  • An item selected in an open diagram
  • An item selected in certain dialogs, such as the attribute 'Properties' dialog

The supported ObjectTypes can be any one of these values:

  • otElement
  • otPackage
  • otDiagram
  • otAttribute
  • otMethod
  • otConnector
ObjectType

GetContextObject ()

Object

Notes: Returns the current context Object.

GetCounts ()

String

Notes: Returns a set of counts from a number of tables within the base Enterprise Architect repository. These can be used to determine whether records have been added or deleted from the tables for which information is retrieved.

GetCurrentDiagram ()

Diagram

Notes: Returns a selected diagram.

Diagram Class

GetCurrentLoginUser (boolean GetGuid)

String

Notes: If security is not enabled in the repository, an error is generated.

If 'GetGuid' is True, a GUID generated by Enterprise Architect representing the user is returned; otherwise the text as entered in System Users/User Details/Login is returned.

GetDiagramByGuid (string Guid)

Diagram

Notes: Returns a pointer to a diagram using the global reference ID (global ID). This is usually found using the diagram GUID property of an element, and stored for later use to open a diagram without using the collection GetAt() function.

Parameters:

  • Guid: String - the GUID of the diagram to locate
Diagram Class

GetDiagramByID (long DiagramID)

Diagram

Notes: Gets a pointer to a diagram using an absolute reference number (local ID). This is usually found using the DiagramID property of an element, and stored for later use to open a diagram without using the collection GetAt() function.

Parameters:

  • DiagramID: Long - the ID of the diagram to locate
Diagram Class

GetDiagramImageAndMap (string DiagramGUID, string Directory)

Boolean

Notes: Saves the image and image-map for the diagram with the specified GUID, in the specified directory location.

The image will be saved in PNG format and will have the DiagramGUID as the image name. The image-map will be saved as a TXT file and will have the DiagramGUID as the image-map name.

The 'Auto Create Diagram Image and Image Map' option must be selected in the model-specific options for this function to save the image and image-map.

Parameters:

  • DiagramGUID – the GUID of the diagram for which the image and image-map are to be saved
  • Directory – the directory into which the image and image-map are to be saved
Cloud Page

GetElementByGuid (string Guid)

Element

Notes: Returns a pointer to an element in the repository, using the element's GUID reference number (global ID). This is usually found using the ElementGUID property of an element, and stored for later use to open an element without using the collection 'GetAt ()' function.

Parameters:

  • Guid: String - the GUID of the element to locate
Element Class

GetElementByID (long ElementID)

Element

Notes: Gets a pointer to an element using an absolute reference number (local ID). This is usually found using the ElementID property of an element, and stored for later use to open an element without using the collection GetAt () function.

Parameters:

  • ElementID: Long - the ID of the element to locate
Element Class

GetElementsByQuery (string QueryName, string SearchTerm)

Collection (of type Element)

Notes: Helps you to run a search in Enterprise Architect, returning the result as a collection.

For example: GetElementsByQuery('Simple','Class1'), where the results list elements with 'Class1' in the 'Name' and 'Notes' fields.

Parameters:

  • QueryName: String - the name of the search to run, for example 'Simple'
  • SearchTerm: String - the term to search for
Collection Class Element Class

GetElementSet (string IDList, long Options)

Collection (of type Element)

Notes: Returns a set of elements as a collection based on a comma-separated list of ElementID values. By default, if no values are provided in the IDList parameter, all objects for the entire project are returned.

Parameters

  • IDList: String - a comma-separated list of ElementID values
  • Options: Long - modifies default behavior of this method
  1. Returns empty collection when empty IDList parameter is given.
  2. Use IDList string as an SQL query to populate this collection.
Collection Class Element Class

GetFieldFromFormat (string Format, string Text)

String

Notes: Converts a field from your preferred format to Enterprise Architect's internal format; returns the field in that format.

Parameters:

  • Format: String - The format to convert the field from; valid formats are:
         - HTML - Full HTML
         - RTF - Rich Text Format
         - TXT - Plain text
  • Text: String - The field to be converted

GetFormatFromField (string Format, string Text)

String

Notes: After accessing a field that contains formatting, use this method to convert 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 text
  • Text: String - The field to be converted

GetFormattedName (string Guid, long FlagInclude, string Separator, long FlagFormat)

String

Notes: Provides special formatting for the name of the specified object; for example, the fully qualified name of a specific element or feature.

Parameters:

  • Guid: String - The GUID of the object to be formatted
  • FlagInclude: Long - Items to be included in the formatted name:
         -  fiFeature = &H01
         -  fiClass = &H02
         -  fiParents = &H04
         -  fiPackage = &H08
         -  fiRootNS = &H10
         -  fiHiddenNS = &H20
         -  fiDiagram = &H40
         -  fiElemAlias = &H80
  • Separator: String - The string to use for separating each included item (such as Packages or elements)
  • FlagFormat: Long - Additional formatting options:
         -  ffReplaceSpaces = &H01
         -  ffLowercase = &H02
         -  ffURLEncode = &H04

Example:

FormattedName = Repository.GetFormattedName (Element.ElementGUID, fiFeature Or fiClass Or fiParents Or fiPackage Or fiDiagram, "::", 0)

GetGapAnalysisMatrix ()

String

Notes: Read Only

Returns all Gap Analyses as an XML document.

Gap Analysis Matrix

GetLastError ()

String

Notes: Returns a string value describing the most recent error that occurred in relation to this object.

GetLocalPath (string Type, string Path)

String

Notes: Returns the expanded local file path for code generated from an element, with reference to the Type and Path defined 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.

Local Paths Dialog

GetMailInterface ()

MailInterface

Notes: Returns an instance of the EA.MailInterface; use this interface to automate the process of creating and sending Model Mail messages.

Mail Interface Package

GetMethodByGuid (string Guid)

Method

Notes: Returns a pointer to a method in the repository; this is usually found using the MethodGUID property of a method.

Parameters:

  • Guid: String - the GUID of the method to look for
Method Class

GetMethodById (string Id)

Method

Notes: Returns a pointer to a method in the repository; this is usually found using the MethodID property of a method.

Parameters:

  • Id: String - the ID of the method to look for
Method Class

GetPackageByGuid (string Guid)

Package

Notes: Returns a pointer to a Package in the repository using the Package's GUID reference number (global ID). This is usually found using the PackageGUID property of the Package.

Each Package in the model also has an associated element with the same GUID, so if you have an element with Type="Package" then you can load the Package by calling:

     GetPackageByGuid(Element.ElementGUID)

Parameters:

  • Guid: String - the GUID of the Package to look for
Package Class

GetPackageByID (long PackageID)

Package

Notes: Get a pointer to a Package using an absolute reference number (local ID). This is usually found using the PackageID property of a Package, and stored for later use to open a Package without using the collection GetAt () function.

Parameters:

  • PackageID: Long - the ID of the Package to locate
Package Class

GetProjectInterface ()

Project

Notes: Returns a pointer to the EA.Project interface (the XML-based automation server for Enterprise Architect). Use this interface to work with Enterprise Architect using XML, and also to access utility functions for loading diagrams, running reports and so on.

Project Interface Package Project Class

GetPropertiesTab (string TabName)

Notes: Finds an existing Properties tab.

Returns a PropertiesTab interface if the tab exists, otherwise NULL.

Parameters:

  • TabName: String - The name of the 'Properties' tab.
PropertiesTab Class

GetReferenceList (string Type)

Reference

Notes: Uses the list type to get a pointer to a Reference List object.

Parameters:

  • Type: String - specifies the list type to get; valid list types are:
         -  Diagram
         -  Element
         -  Constraint
         -  Requirement
         -  Connector
         -  Status
         -  Cardinality
         -  Effort
         -  Metric
         -  Scenario
         -  Status
         -  Test
         -  List:DifficultyType
         -  List:PriorityType
         -  List:TestStatusType
         -  List:ConstStatusType
Reference Class

GetRelationshipMatrix ()

String

Notes: Returns an XML document (as a string), containing definitions of all Relationship Matrix profiles saved in the current model.

Relationship Matrix

GetTechnologyVersion (string ID)

String

Notes: Returns the version of a specified MDG Technology resource.

Parameters:

  • ID: String - the specified technology ID

GetTreeSelectedElements ()

Collection

Notes: Returns the set of elements currently selected in the Browser window as a collection.

Collection Class

GetTreeSelectedItem (object SelectedItem)

ObjectType

Notes: Gets an object variable and type corresponding to the currently selected item in the tree view.

To use this function, create a generic object variable and pass this as the parameter. Depending on the return type, cast it to a more specific type.

The object passed back through the parameter can be a Package, element, diagram, attribute or operation object.

Parameters:

  • SelectedItem: Object - the object to get the variable and type for
ObjectType

GetTreeSelectedItemType ()

ObjectType

Notes: Returns the type of the object currently selected in the tree. One of:

  • otDiagram
  • otElement
  • otPackage
  • otAttribute
  • otMethod
ObjectType

GetTreeSelectedObject ()

Object

Notes: The related method GetTreeSelectedItem () has an output parameter that is inaccessible by some scripting languages. As an alternative, this method provides the selected item through the return value.

GetTreeSelectedPackage ()

Package

Notes: Returns the Package in which the currently selected tree view object is contained.

Package Class

HasPerspective (string Perspective)

String

Notes: Deprecated - no longer in use.

HideAddinWindow ()

Notes: Hides the docked Add-In window.

Custom Docked Window

ImportPackageBuildScripts (string PackageGuid, string BuildScriptXML)

Notes: Imports build scripts into a Package in Enterprise Architect.

Parameters:

  • PackageGuid: String - the GUID of the Package into which to import the build scripts
  • BuildScriptXML: String - the build script XML data, which you can export from within Enterprise Architect

ImportRASAsset (string PackageGUID, string Protocol, string ServerName, string Model, string Storage, string RASGUID, string Password, string Version)

Notes: Imports the specified RAS asset.

Returns True on success; check GetLastError on failure.

Parameters:

  • PackageGUID: String  - the GUID of the Package to import the asset to
  • Protocol: String  - the protocol the server is using
  • ServerName: String  - the name of the RAS server
  • Model: String - the name of the RAS model to use
  • Storage: String - the storage name of the RAS asset
  • RASGUID: String - the GUID of the RAS asset
  • Password: String - the password to access the RAS asset
  • Version: String - the version of the RAS asset to import

ImportTechnology (string Technology)

Boolean

Notes: Installs a given MDG Technology resource into the repository.

Returns True if the technology is successfully loaded into the model. Otherwise returns False.

This applies to technologies imported into pre-7.0 versions of Enterprise Architect (imported technologies), not to technologies referenced in version 7.0 and later (referenced technologies).

Parameters:

  • Technology: String - the contents of the technology resource file
Deploy an MDG Technology

InsertSBPIParameter (string packedParameters, string name, string value)

Notes: Returns a JSON string.

Parameters:

  • packedParameters: String - The JOSN string to append the Name/Value to; cannot be empty
  • name: String - The name of the parameter
  • value: String - The value of the parameter

InvokeConstructPicker (string ElementFilter)

String

Notes: Invokes the 'Select <Item>' dialog with filters on the object type and, optionally, stereotype. Returns the ElementID of the selected object, or 0 if no object was selected when the dialog was closed.

For example:

elementid=Repository.InvokeConstructPicker ("IncludedTypes=Class,Component;StereoType=foo,bar")

In this example, the 'Select <item>' dialog will allow the user to select any Class or Component element in the model that has a stereotype of 'foo' or 'bar'. The 'IncludedTypes' and 'StereoType' filters are separated by a semi-colon.

Parameters:

  • ElementFilter: String - specifies which elements or Packages are to be made available for selection, based on element types and stereotypes identified by the IncludedTypes and StereoType filters
         -  IncludedTypes - (mandatory) comma separated list of
            element types that can be selected in the dialog; for
            example:
                 Package,Class,Component
         -  MultiSelect - (optional) when set to True
             ("MultiSelect=True;") allows the Construct picker to select
             multiple elements
         -  Selection (optional) - list of comma-separated element
             GUIDs that will be selected by default
         -  GetNext (optional) - returns the next ID in the list of 
             selected elements, or 0 when no more are available; this 
             option will not display a dialog and assumes the first call 
             was made with MultiSelect=True;
         -  StereoType - (optional) comma separated list of
             stereotypes that can be selected in this dialog

Do not use leading or trailing spaces between element type or stereotype values. Parameter values must be written with the correct case; element type names are also case sensitive.

Example:

     val = Repository.InvokeConstructPicker ("IncludedTypes=Class; MultiSelect=True;");

          while(val != 0)

          {

               val = Repository.InvokeConstructPicker("GetNext=True;");

          }

Select Dialog

InvokeFileDialog (string FilterString, long Filterindex, long Flags)

String

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

Parameters:

  • FilterString: String - list of file type filters.
  • Filterindex: Long - one-based index of the filter to be used by default
  • Flags: Long - additional bit flags used to initialize the file dialog; see OPENFILENAME structure in MSDN documentation for accepted values
Project Class

IsTabOpen (string TabName)

String

Notes: Checks whether a named Enterprise Architect tabbed view is open and active. This includes open diagram windows 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, or
  • 0 to indicate that it is not visible at all

Parameters:

  • TabName: String - the name of the tab to check for; TabName is case sensitive

IsTechnologyEnabled (string ID)

Boolean

Notes: Checks whether the specified string matches the ID of an enabled MDG Technology in Enterprise Architect.

Returns True if the string matches the ID of an enabled Technology. Otherwise returns False.

Parameters:

ID: String - the technology ID to check for; built-in technology IDs include:

  • ArcGIS                               ArcGIS
  • BABOK                              BABOK
  • BIZBOK                             BIZBOK Guide
  • BPSim                               BPSim
  • BRM                                  Business Rule Model
  • CMMN                              Case Management Model & Notation
  • CODEENG                       Code Engineering
  • Database Modeling          Database Modeling
  • DMN1.1                            DMN1.1
  • EAExtended                     Core Extensions
  • ERD                                   Entity Relationship Diagram
  • GML                                  GML
  • MYSQLTECH                   MySqlTech
  • EAReview                         Review
  • SIMF                                 SIMF Technology
  • SOAML                            SOAML
  • SysML1.1                         SysML1.1
  • SysML1.2                         SysML1.2
  • SysML1.3                         SysML1.3
  • SysML1.4                         SysML1.5
  • UML2                                Basic UML2 Technology
  • SYSENG                           System Engineering
  • 262139                             MDG Technology Builder
  • TOGAF                             TOGAF
  • UAF                                   UAF
  • UPDM2                             UPDM 2.0
  • Win32UI                            Win 32 User Interface Modeling
  • ZF                                       Zachman Framework

Technically, any combination of technologies integrated with or added to Enterprise Architect - including user-developed technologies - could appear in this list. In practice you would only check for one or two technologies at a time.

IsTechnologyLoaded (string ID)

Boolean

Notes: Checks whether a specified technology is loaded into the repository.

Returns True if the MDG Technology resource is loaded into the repository. Otherwise returns False.

Parameters:

  • ID: String - the technology ID to check for

LoadAddins ()

Notes: Loads all Add-Ins from a repository when Enterprise Architect is opened from automation.

OpenDiagram (long DiagramID)

Notes: Provides a method for an automation client or Add-In to open a diagram. The diagram is added to the tabbed list of open diagrams in the main Enterprise Architect view.

Parameters:

  • DiagramID: Long - the ID of the diagram to open

OpenFile (string Filename)

Boolean

Notes: This is the main point for opening an Enterprise Architect project file from an automation client, and working with the contained objects.

If the required project is a DBMS or Cloud based repository, you will require a valid Enterprise Architect connection string.  This can be obtained in one of two ways; both methods require you to first make and open a connection to the model in question with Enterprise Architect:

1)  Using the 'Save as Shortcut' menu item, create a shortcut .eap file containing the database connection string; you can call this shortcut file to access the repository.

2)  Alternatively, you can right-click on the model's connection entry in the 'Open Project' screen and select 'Edit connection string', this connection string can then be used direct by OpenFile.

Parameters:

  • Filename: String - the filename (or connection string) of the Enterprise Architect project to open
Managing Connections to Projects

OpenFile2 (string FilePath, string Username, string Password)

Boolean

Notes: As for 'OpenFile ()' except this provides for the specification of a password.

Parameters:

  • Filepath: String - the file path of the Enterprise Architect project to open
  • Username: String - the user login ID
  • Password: String - the user password

RefreshModelView (long PackageID)

Notes: Reloads a Package or the entire model, updating the user interface.

Parameters:

  • PackageID: Long - the ID of the Package to reload: if 0, the entire model is reloaded; if a valid Package ID, only that Package is reloaded

RefreshOpenDiagrams (boolean FullReload)

Notes: Reloads the diagram contents for all open diagrams from the repository.

Parameters:

  • FullReload: Boolean - if False only the contents of element compartments are reloaded; if True the full content of each diagram is reloaded

ReloadDiagram (long DiagramID)

Notes: Reloads a specified diagram. This would commonly be used to refresh a visible diagram after code import/export or other batch process where the diagram requires complete refreshing.

Calling this method within a call to EA_OnNotifyContextItemModified is not supported

Parameters:

  • DiagramID: Long - the ID of the diagram to be reloaded
EA_OnNotifyContextItemModified

ReloadPackage (long PackageID)

Notes: Reloads a Package and its open child diagrams.

Parameters:

PackageID: Long - The ID of the Package to reload; if a valid Package ID, only that Package is reloaded.

RemoveOutputTab (string Name)

Notes: Removes a specified tab from the System Output window.

Parameters:

  • Name: String - the name of the tab to be removed

RemoveWindow (string WindowName)

Boolean

Notes: Removes an Add-In window that matches the specified WindowName.

Parameters:

  • WindowName: String - the name of the window to remove

RepositoryType ()

String

Notes: Returns the currently open database/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 (string sQueryName, string sSearchTerm, string sSearchOptions, string sSearchData)

Notes: Runs a search, displaying the results in Enterprise Architect's Model Search window.

Parameters:

  • sQueryName: String - the name of the search to run, for example Simple
  • sSearchTerm: String - the term to search for
  • sSearchOptions: String - currently not being used
  • sSearchData: String - a list of results in the form of XML, which is appended onto the result list in Enterprise Architect - see the XML Format topic; this parameter is not mandatory so pass in an empty string to run the search as per normal
XML Format (Search Data) Project Class

SaveAllDiagrams ()

Notes: Saves all open diagrams.

SaveAuditLogs (string FilePath, object StartDateTime, object EndDateTime)

Boolean

Notes: Saves the Audit Logs contained within a model to a specified file.

If 'StartDateTime' and 'EndDateTime' are not null then only log items that fall into this period are saved.

Returns True for success, False for failure.

  • This might fail if the user logged into the model does not have the correct access permission

Parameters:

  • FilePath: String - the file to save the Audit Logs to
  • StartDateTime: Variant (DateTime) - the earliest date and time of log entries to save
  • EndDateTime; Variant (DateTime) - the latest date and time of log entries to save

SaveDiagram (long DiagramID)

Notes: Saves an open diagram; assumes the diagram is open in the main user interface Tab list.

Parameters:

  • DiagramID: Long - the ID of the diagram to save

SaveDiagramAsUMLProfile (string DiagramGUID, string Filename)

Boolean

Notes: Saves a given diagram as a UML Profile, using the settings from the previous time that the specific diagram was saved manually.

The returned value indicates success or failure.

Parameters:

  • DiagramGUID: String - the GUID of the Profile diagram to save
  • Filename: String - the name and path of the file to create; if left blank, the method will use the filename from the previous time the specified diagram was saved

SavePackageAsUMLProfile (string PackageGUID, string Filename)

Boolean

Notes: Saves a given Package as a UML Profile, using the settings from the previous time that the specific Package was saved manually.

The returned value indicates success or failure.

Parameters:

  • PackageGUID: String - the GUID of the Profile Package to save
  • Filename: String - the name and path of the file to create; if left blank, the method will use the filename from the previous time the specified Package was saved

ScanXMIAndReconcile ()

Notes: Scans the Package XMI files associated with each of the project's controlled Packages and restores any diagram objects or cross-references that are detected as missing from the project.

This function is useful in team environments where each user maintains their own private copy of the model database (that is, multiple private EAP files) and model updates are propagated through the use of controlled Packages; it provides no benefit when the model is hosted in a single shared database that is accessed by all team members.

Each controlled Package is compared with its associated XMI file and, if the cross-reference information in the model does not match the XMI, Enterprise Architect updates the model with the information from the XMI and records the update in the System Output window.

You can roll back such updates by right-clicking on the entry in the System Output window and selecting the 'Rollback Update' option (or 'Rollback Selected Updates' if multiple entries are selected).

Closing the model clears the entries in the System Output window; an entry in this window is also cleared as and when you roll-back the update for it.

This functionality is invoked automatically as part of the 'Get All Latest' operation.

When working in an environment that uses a Private Model deployment and your model contains a significant number of cross-Package references, it is recommended that you invoke this function from time to time, following the re-importation of controlled Packages - for example, after using 'Get Latest' to update a number of Packages, or after performing a number of Package check-outs.

As a general rule, avoid running this function while you have uncommitted changes 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 Packages and run 'ScanXMIAndReconcile' again

ShowAddinWindow (string TabName)

Boolean

Notes: Shows the docked Add-In window on the specified page. Returns True if a tab of the specified name is now displayed.

Parameters

  • TabName: String - specifies the tab
Custom Docked Window

ShowDynamicHelp (string Topic)

Notes: Shows a Help topic as a view.

Parameters:

  • Topic: String - specifies the Help topic

ShowInProjectView (object Item)

Notes: Selects a specified object in the Browser window.

Accepted object types are Package, Element, Diagram, Attribute, and Method; an exception is thrown if the object is of an invalid type.

Parameters:

  • Item: Object - the object to highlight

ShowWindow (long Show)

Notes: Shows or hides the Enterprise Architect User Interface.

Parameters:

  • Show: Long

SQLQuery (string SQL)

String

Notes: Enables execution of a SQL select statement against the current repository.

Returns an XML formatted string value of the resulting record set.

Parameters:

  • SQL: String - contains the SQL Select statement

SynchProfile (string Profile, string Stereotype)

Boolean

Notes: Synchronizes Tagged Values and constraints of a UML Profile item using the 'Synch Profiled Elements' dialog.

Parameters:

  • Profile: String - the name of the profile that contains the stereotype
  • Stereotype: String - the name of the profile stereotype for which the default tags and constraints are to be synchronized
Synchronize Tagged Values and Constraints

VCRPS

Type VersionControlResynchPkgStatuses (boolean ClearSettings)

Notes: Synchronizes the Version Control status of each Version Controlled Package within the current model with the status reported by your Version Control provider.

Parameters:

  • ClearSettings: Boolean
         -  if True, clear the Version Control settings from Packages
            that are reported by the Version Control provider as
            uncontrolled
         -  if False, leave the Version Control settings unchanged for
            Packages reported as uncontrolled
Resynchronize the Status of Version Controlled Packages

WriteOutput (string Name, string Output, long ID)

Notes: Writes text to a specified tab in the System Output window, and associates the text with an ID.

Parameters:

  • Name: String - specifies the tab on which to display the text
  • Output: String - specifies the text to display
  • ID: Long - specifies a numeric ID value to associate with this output item for further handling by Add-Ins; can be set to 0 if no handling is required
EA_OnOutputItemClicked EA_OnOutputItemDoubleClicked