Search code examples
javascriptenterprise-architect

Enterprise Architect: Access View stereotypes from script


I am writing a bulk edit script in Enterprise Architect 16.1.1622 in Javascript. It should let the user select properties from all common properties of all selected elements. For each of those chosen properties I want to list all possible predefined values (if available).

This works well for Repository.GetReferenceList and Repository.PropertyTypes (via Detail Value=…), but I can‘t find the predefined values for the inherited properties of a stereotype from a custom view.

We have a company profile (sorry not too sure about the right term) included via MDG Technologies. In there are several types defined. If I now set the stereotype of a default action to a type of this profile, then my action will inherit specific properties of that type. Let‘s say we have a property called ‚Color‘ with predefined values ‚red‘, ‚green' and ‚blue‘, which is defined in the company profile and inherited by the action.

I can now change this property for this action according to the predefined values in the GUI. I can also read and write this property programmatically. But I can‘t get a list of these predefined values programatically.

This list is what I am searching for.


Solution

  • The predefined values for those properties (AKA tagged values) are stored in the UML profile that is included in you MDG file.

    The MDG file is an XMLand a property could look like the following:

    <Stereotype name="MyStereotype" notes="" cx="0" cy="0" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0" isAbstract="true">
        <TaggedValues>
            <Tag name="color" type="enumeration" description="" unit="" values="green,red,blue,other" default="other"/>
        </TaggedValues>
    </Stereotype>
    

    So in order to know which values a tagged value can have, you'll have to parse the MDG file.

    One of the issues is that the MDG file can be loaded by EA in different ways

    • imported into the database
    • on a shared location
    • in the users own profile
    • loaded as part of an add-in
    • others???

    So you would basically need to reproduce the way EA loads MDG files. If it's only for your company's MDG, you could agree to put it on a fixed location so you can read that.

    If you are trying to make a generic add-in/script then I'm afraid you are out of luck.