Repository

public Class

The Repository is the main container of all structures such as models, packages and elements. You can iteratively begin accessing the model using the Models collection. It 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

Type

Notes

Authors

Collection

Read only. The system Authors collection. Contains 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.

BatchAppend

Boolean

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

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

ConnectionString

String

Read only. The filename/connection string of the current Repository.

Datatypes

Collection

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

EAEdition

EAEditionTypes

Read only. Returns the level of core licensed functionality available to the current repository.

Note:

This property returns Corporate when the edition is Business and Software Engineering, Systems Engineering or Ultimate. Use EAEditionEx to identify which of these extended editions is available.

EAEditionEx

EAEditionTypes

Read only. Returns the level of extended licensed functionality available to the current repository.

EnableCache

Boolean

Read/Write. An optimization for pre-loading package objects when dealing with large sets of automation objects.

EnableUIUpdates

Boolean

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 the changes to the user, call Repository.RefreshModelView().

FlagUpdate

Boolean

Read/Write. Instructs Enterprise Architect to update the Repository with the LastUpdate value.

InstanceGUID

String

Read only. The identifier string identifying the Enterprise Architect runtime session.

IsSecurityEnabled

Boolean

Read only. Checks whether User Security is enabled for the current repository.

Issues

Collection

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

LastUpdate

String

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

LibraryVersion

Long

Read only. The build number of the Enterprise Architect runtime.

Models

Collection
of type Package

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 Project Browser 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.

ObjectType

ObjectType

Read only. Distinguishes objects referenced through the Dispatch interface.

ProjectGUID

String

Read only. Returns a unique ID for the project.

PropertyTypes

Collection

Read only. Collection of Property Types available to the Repository.

Resources

Collection

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.

Stereotypes

Collection

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

SuppressEADialogs

Boolean

Read/Write. Set this property in the EA_OnPostNewElement or EA_OnPostNewConnector broadcast events to control whether Enterprise Architect should suppress showing the default Properties dialogs to the user when an element or connector is created.

Tasks

Collection

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

Terms

Collection

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

Repository Methods

Method

Type

Notes

ActivateDiagram (long DiagramID)

 

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

Deprecated - no longer in use.

ActivateTab (string Name)

 

Activates an open Enterprise Architect tabbed view.

Parameters:

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

ActivateTechnology (string Name)

 

Activates an enabled MDG Technology.

Parameters:

  • Name: String - the name of the Technology to activate.

ActivateToolbox (string Toolbox, long Options)

Boolean

Activates a Toolbox page in the GUI.

Returns true if the specified Toolbox page is successfully activated, otherwise returns false.

Parameters:

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

AddDefinedSearches (string sXML)

 

Enables you 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.

AddPerspective (string Perspective, long Options)

Boolean

Deprecated - no longer in use.

AddTab (string TabName, string ControlID)

activeX custom control

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, Project1,UserControl1.

AddWindow (string WindowName, string ControlID)

activeX custom control

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.

The window can be shown by selecting it from the list in the Workspace Layouts toolbar - click on the third icon from the right and look at the end of the list.

Parameters:

  • WindowName: String - used as the window title.
  • ControlID: String - the ProgID of the control; for example, Project1,UserControl1.

AdviseConnectorChange (long ConnectorID)

 

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)

 

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.

ChangeLoginUser (string Name, string Password)

Boolean

Sets the currently logged on user to be that 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

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.

Notes:

  • 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)

 

Removes all the text from a tab in the Output window. See also CreateOutputTab, EnsureOutput Visible, WriteOutput.

Parameters:

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

CloseAddins ()

 

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)

 

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 ()

 

Closes any open file.

CreateModel (CreateModelType CreateType, string FilePath, long ParentWnd)
 

Boolean

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.

CreateOutputTab (string Name)

 

Creates a tab in the Output window. See also ClearOutput, EnsureOutput Visible, WriteOutput.

Parameters:

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

DeletePerspective (string Perspective, long Options)

Boolean

Deprecated - no longer in use.

DeleteTechnology (string ID)

Boolean

Removes a specified MDG Technology resource from the repository.

Returns true, if the technology is successfully removed from the model. Returns false otherwise.

Note:

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). See Deploy an MDG Technology (from Add-Ins).

Parameters:

  • ID: String - the ID of the technology.

EnsureOutputVisible (string Name)

 

Ensures that a specified tab in the Output window is visible to the user. The Output window is made visible if it is hidden. See also ClearOutput, CreateOutputTab, WriteOutput.

Parameters:

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

ExecutePackageBuildScript (long ScriptOptions, string PackageGuid)

 

Enables you to run the active package build script based on your current selection in the Project Browser. 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

 

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

GetActivePerspective ()

String

Deprecated - no longer in use.

GetAttributeByGuid (string Guid)

Attribute

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.

GetAttributeByID (string Id)

Attribute

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.

GetConnectorByGuid (string Guid)

Connector

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.

GetConnectorByID (long ConnectorID)

Connector

Searches the repository for a connector with a specific ID.

Parameters:

  • ConnectorID: Long - the ID of the connector to locate.

GetContextItem (object Item)

ObjectType

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 (below).

Parameters:

  • Item: Object - the item to point to.

GetContextItemType ()

ObjectType

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 Project Browser
  • 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 the following values:

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

GetContextObject ()

Object

Returns the current context Object.

GetCounts ()

String

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

Returns a selected diagram.

GetCurrentLoginUser (boolean GetGuid = false)

String

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

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 an diagram without using the collection GetAt() function.

Parameters:

  • Guid: String - the GUID of the diagram to locate.

GetDiagramByID (long DiagramID)

Diagram

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.

GetElementByGuid (string Guid)

Element

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.

GetElementByID (long ElementID)

Element

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.

GetElementsByQuery (string QueryName, string SearchTerm)

 

Enables the user to run a search in Enterprise Architect, returning the result as a collection.

For example GetElementsByQuery('Simple','Class1'), where results contain 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.

GetElementSet (string IDList, long Options)

Collection

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 behaviour 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.

GetFieldFromFormat (string Format, string Text)

String

Converts a field from your preferred format to Enterprise Architect's internal format. Returns the field in Enterprise Architect's internal 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

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.

GetLastError ()

String

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

This function is rarely used as an exception is thrown when an error occurs.

GetMethodByGuid (string Guid)

Method

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.

GetMethodById (string Id)

Method

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.

GetPackageByGuid (string Guid)

Package

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.

GetPackageByID (long PackageID)

Package

Get a pointer to a package using an absolute reference number (local ID). This is usually found using the PackageID property of an 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.

GetProjectInterface ()

Project

Return 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.

GetReferenceList (string Type)

Reference

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 and
    Test.

GetTechnologyVersion (string ID)

String

Returns the version of a specified MDG Technology resource.

Parameters:

  • ID: String - the specified technology ID.

GetTreeSelectedElements()

Collection

Returns the set of elements currently selected in the Project Browser as a collection.

GetTreeSelectedItem (object SelectedItem)

ObjectType

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.

GetTreeSelectedItemType ()

ObjectType

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

  • otDiagram
  • otElement
  • otPackage
  • otAttribute
  • otMethod.

GetTreeSelectedObject ()

Object

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

Returns the package in which the currently selected tree view object is contained.

HasPerspective (string Perspective)

String

Deprecated - no longer in use.

ImportPackageBuildScripts (string PackageGuid, string BuildScriptXML)

 

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.

ImportTechnology (string Technology)

Boolean

Installs a given MDG Technology resource into the repository.

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

Note:

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). See Deploy an MDG Technology (from Add-Ins).

Parameters:

  • Technology: String - the contents of the technology resource file.

IsTabOpen (string TabName)

String

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.

Note:

TabName is case-sensitive.

Parameters:

  • TabName: String - the name of the tab to check for.

IsTechnologyEnabled (string ID)

Boolean

Checks whether a specified technology is enabled in Enterprise Architect.

Returns True if the MDG Technology resource is enabled. Otherwise returns False.

Parameters:

  • ID: String - the technology ID to check for.

IsTechnologyLoaded (string ID)

Boolean

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.

OpenDiagram (long DiagramID)

 

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

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 repository, and you have created a shortcut .EAP file containing the database connection string, you can call this shortcut file to access the DBMS repository.

You can also connect to a SQL database by passing in the connection string itself instead of a filename. A valid connection string can be obtained from the Open Project dialog by selecting a recently opened SQL repository.

Parameters:

  • Filename: String - the filename of the Enterprise Architect project to open.

OpenFile2 (string FilePath, string Username, string Password)

Boolean

As for OpenFile() except this enables 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)

 

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)

 

Refreshes the diagram contents for all diagrams open in Enterprise Architect.

Parameters:

  • FullReload: Boolean - if false the displayed contents of elements and connectors are refreshed in each diagram; if true each of the diagrams is completely reloaded from the repository.

ReloadDiagram (long DiagramID)

 

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.

Parameters:

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

RemoveOutputTab (string Name)

 

Removes a specified tab from the Output window.

Parameters:

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

RunModelSearch (string sQueryName, string sSearchTerm, string sSearchOptions, string sSearchData)

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 - enables you to supply a list of results in the form of XML, which is appended onto the result list in Enterprise Architect. See XML Format; this parameter is not mandatory so pass in an empty string to run the search as per normal.

SaveAllDiagrams ()

 

Saves all open diagrams.

SaveAuditLogs (string FilePath, object StartDateTime, object EndDateTime)

Boolean

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.

Note:

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)

 

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.

ShowDynamicHelp (string Topic)

 

Shows a help topic as a view.

Parameters:

  • Topic: String - specifies the help topic.

ShowInProjectView (object Item)

 

Selects a specified object in the Project Browser.

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.

ShowProfileToolbox (string Technology, string Profile, boolean Show)

 

Shows/hides the contents of a specified technology or profile in the Toolbox.

To show/hide a profile in the Toolbox, specify the profile's ID value in the Profile parameter and set the Technology parameter to a null string.

To show/hide a technology in the Toolbox, specify the technology's ID in the Technology parameter and set the Profile parameter to a null string.

Parameters:

  • Technology: String - the ID of the technology.
  • Profile: String - the ID of the profile.
  • Show: Boolean - if true, show the technology or profile; if false, hide the technology or profile.

ShowWindow (long Show)

 

Shows or hides Enterprise Architect.

Parameters:

  • Show: Long.

SQLQuery (string SQL)

String

Enables execution of a SQL select statement against the current repository. Returns an XML formatted string value of the resulting recordset.

Parameters:

  • SQL: String - contains the SQL Select statement.

VersionControlResynchPkgStatuses (boolean ClearSettings)

 

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.

WriteOutput (string Name, string String, long ID)

 

Writes text to a specified tab in the Output window, and associates the text with an ID. See also ClearOutput, CreateOutputTab, EnsureOutput Visible.

Parameters:

  • Name: String - specifies the tab on which to display the text.
  • String: String - specifies the text to display.
  • ID: Long - specifies the ID the text is associated with.