Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Geert Bellekens

Pages: 1 ... 475 476 [477] 478 479 ... 532

I'm sure this can't be that hard to write.
"Find in all diagrams" is a pretty easy function to write, so all you need to to is loop all elements in the package and call that function for each of them.
You can use my C# EA add-in framework as a basis.
The EA Navigator add-in from the Enterprise Architect Toolpack already has a feature to show the diagrams for operations, so that part can be re-used as well.



Should be possible.
I think notes are just another type of Elements, so you should be able to create just like any other type of Element.
I guess the same thing will be valid for the connector.



It shouldn't be too hard to write something yourself.
I've written an excel importer in VBA a while ago that you can use as inspiration.


I can indeed confirm that this is a great tool for add-in developers.

Thanks for sharing with us Daniel.



I've written an excel importer in VBA a while ago which might be useful as a base.



It is definitely possible to get this information, but you might need to use Repository.SQLQuery(sqlString) to get it if it is not exposed by the API's objects.


And you don't need to roll your own db connection.
Just use Repository.Execute() and the API will take care of the rest.


Hi Sébastien,

The only "safe" way I know of is to use xmi export/import.
The dangerous dirty way is to update the guid in the database after the elements has been created.
You can use Repository.Execute(sqlString) to execute SQL update statements.



I don't think I understood your question.
If you want to re-use the GUID on something else, why do you want to edit it?
Or are you trying to re-use an existing GUID on a new element? In that case, NOOOO :o, that would kind of defeat the purpose of the Globally Unique IDentifier wouldn't it?



If I were you I would still not create my own GUID's.
I would store the external ID in a tagged value (name could be something like "<externalProduct>ID")
That leaves the alias field to be used for the purpose it was intended for, and you don't get stuck if you ever need to do the same with another external product.
As for the searching/iterating, there are a few method in the API that can make your life a bit easyer.
- Repository.GetElementSet (string IDList, long Options) allows you to pass an SQL query that results in a list of element ids in the IDList parameter. That could be a very quick way to create a collection of elements. (this only works for EA.Element's)
- Repository.SQLQuery (string SQL) allows you run a query and get the results in an xml format. You could use this method to get a list of EAID/ExternalID pairs, which you could put into a dictionary or something for quick lookup.

These methods are very fast as they take full advantage of the database capabilities. (i.e. joining two tables) Trying the do the same by iterating all elements and their tagged values would be a lot slower.

This way don't have to mess with the backend DB, and you don't risk forgetting something. I think it will be a lot less error prone.

Also I have noticed that using the Repository.GetElementByID(long ElementID) is a real bottleneck when dealing with a lot of elements. (100+), especially if you're not working on a local EAP file.



The first question that pops up is: Why would you want to set the GUID manually?

Have you tried passing the GUID in the name parameter? It's a long shot, but I've seen stranger behaviour in the EA API :-?


in C# it's like this:
Code: [Select]
       /// <summary>
        /// Gets the Repository object from the currently running instance of EA.
        /// If multiple instances are running it returns the first one opened.
        /// </summary>
        /// <returns>Repository object for the running instance of EA</returns>
        private static EA.Repository getOpenedModel()
                return ((EA.App)Marshal.GetActiveObject("EA.App")).Repository;
            catch (COMException )
                DialogResult result = MessageBox.Show("Could not find running instance of EA.\nStart EA and try again"
                                   , "EA not running",MessageBoxButtons.RetryCancel,MessageBoxIcon.Warning);
                if (result == DialogResult.Retry)
                    return getOpenedModel();
                    return null;

See for an example on how to use it


I've added a new feature to the EA Navigator to navigate to the implementation of an operation. It selects the Behavior element in the project browser and opens all diagrams owned by this behavior element.
More details on my blog
or download the EA Navigator 1.2 Windows Installer directly from github.



You haven't missed anything, there just isn't any documentation about the EA database.

(and YES it's painful ;D)

To complete that:
- t_attributetag for the attributes tagged values
- t_operationtag for the operations tagged values

t_taggedvalue seems to contain "the rest" of the tagged values. The elementID needs to be interpreted depending on the BaseClass.
If it's ASSOCIATION_SOURCE or ASSOCIATION_TARGET then you need to join t_connector on t_connector.ea_guid = t_taggedvalue.ElementID
if its PACKAGE you need to join t_package on ea_guid.


Pages: 1 ... 475 476 [477] 478 479 ... 532