Search code examples
enterprise-architect

How to automate adding Tagged Value Types and editing of templates in Enterprise Architect


I am trying to automate the following tasks in Enterprise Architect:

  1. Add new tagged Value types

2. Make certain changes to DDL Templates (e.g add system versioning to a table by replacing the DDL Create Table Template for MySQL with another template, that contains a "With System Versioning" clause)

Is there a way to achieve this via scripting (https://sparxsystems.com/enterprise_architect_user_guide/15.0/automation/automation_interface.html), by writing an Add In (https://sparxsystems.com/enterprise_architect_user_guide/15.1/automation/addins_2.html) or by using MDG Technologies (https://sparxsystems.com.au/enterprise_architect_user_guide/14.0/modeling_tools/mdgtechnologies_2.html) for Enterprise Architect?

Thank you in advance for all comments, answers and ideas!


Solution

  • Adding tagged value types is definitely possible.

    I use this code in my Model wrapper

    This is C#, but the translation to any other supported language such as VBScript is trivial.

    public void addTaggedValueType(string tagName, string tagDescription, string tagDetail)
    {
        global::EA.PropertyType taggedValueType = (global::EA.PropertyType)this.wrappedModel.PropertyTypes.AddNew(tagName, "");
        taggedValueType.Description = tagDescription;
        taggedValueType.Detail = tagDetail;
        taggedValueType.Update();
    }
    

    I don't think the API has a feature to update DDL templates directly, but you can deploy those with an MDG.

    And you can include an MDG into your add-in. See this add-in class for an example

    Normally tagged value types are also distributed in an MDG and not created directly by an add-in.