7. Object Details

This section is referenced from above sections. You can use it as a quick reference but it contains also a number of information which is not detailed in EA’s help.

Unless otherwise noted all properties are r/w. Collections are r/o in the way that they can not be set to anything different. However, each collection has operations to alter their contents.

There are two general operations bool Update() and string GetLastError() which are not listed below as most objects respond to them and their use is quite obvious. If Update returns false you should consider the return value of GetLastError. Note that it is not cleared by all operations but may reside from an arbitrary previous error. You should only check it after an Update or as noted for different operations.

Since a couple of objects do not have specific operations their appropriate section just lists the attributes. Else attributes and operations appear under separate sub-sections.

I have tested most, but not all of the API listed below. Where appropriate I have added some observation in the API use. Most of the API stems from pre 9.3 EA version which is where this book has been written. Every now and then Sparx adds new functionality and so I added a marker with the EA version in brackets to indicate attributes and operations that have been introduced ever since. Note that a lot of the functions introduced with 12.1 did not work they were described in EA’s help13 when the V13 beta was out for testing already.

7.1 EaRepository

Attributes

EaCollection Authors
An EaCollection of EaAuthor objects.

These are defined with Settings/Project Types/People/Authors.

bool BatchAppend
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.

EaCollection Clients
An EaCollection of EaClient objects.

These are defined with Settings/Project Types/People/Clients.

string ConnectionString
The filename/connection string of the current Repository.

This is either a filename (<drive>:\path\to\file.eap) or an ODBC connection string.

If you find a filename you need to do some additional checks. If the size of the file is small (less than 512k Byte) this is a shortcut file, else it is a .EAP. If it is a shortcut file then you have to read its contents. The first line starts with EAConnectString: followed by the real connection string (this is only one recursion as it seems). You can forget about the optional following lines14 which are commands to EA to do certain actions upon opening EA.

Detailed information about the construction of connection strings will be found via Google15. However, the connection string will contain DBType=<n>; where <n> is one of

0 - MYSQL
1 - SQLSVR
2 - ADOJET
3 - ORACLE
4 - POSTGRES
5 - ASA
7 - OPENEDGE
8 - ACCESS2007

EaCollection Datatypes
An EaCollection of EaDatatype objects.

These are defined with Settings/Code Datatypes....

… omitted …