In case anyone else has the same need to alter mappings for data types from the source class model to a destination model, such as DDL, here is a method that works. There should be a better method, but I did not find it.
**********************************************************************
First, ensure the destination model in EA already has all appropriate data types defined.
**********************************************************************
If your destination is a database and you want to use User Defined Data Types (UDDT) / Alias Data Types (ADT), create those in the model.
Configure \ Reference Data \ Settings \ Database Datatypes…
When you define the adt in EA in the Database Datatypes dialog:
• select the None radio button in the Size group; not doing this will result in EA creating DDL scripts for database generation with invalid syntax
◦ do not include a length for ADTs based on a type such as char or varchar;.
◦ do not include the precision and scale for ADTs based on a type such as decimal
• Maybe include the schema name with the name of the ADT in the Datatype field, such as "dbo.adtYesNo" instead of "adtYesNo"
You will need to create the ADT in the target database, before executing DDL scripts generated by EA that use the ADT. Sample script:
create type dbo.adtTaxRate
from decimal(9,8) not null;
create type dbo.adtYesNo
from char(1) not null;
--drop type dbo.adtTaxRate;
--drop type dbo.adtYesNo;
**********************************************************************
Second, consider creating Type elements, for reuse and ease
**********************************************************************
I do not know if this is the best or proper method to create reusable data types, but it works.
1. Create Types for use in the source Domain Model
• In the Project Browser, create a "Types" package to hold the new types to be created
• Right-click the "Types" package, choose "Add Element..."
• In the New Element dialog:
◦ Enter a name for the type or alias data type (ADT)
◦ Set Type to "Type"
2. In the classes in the Domain Model, set types for the various attributes as needed.
• Select a class in the Domain Model
• Open Features pane. If necessary, move the selector to Attributes at the top, to show Attributes.
• Use dropdown list for Type. If the type you want is not already available; select "Select Type..."; browse to the package that holds your Types; select the appropriate type.
**********************************************************************
Third, correct the mapping
**********************************************************************
Open the Transformation Editor; see the “Opening the Transformation Editor” section.
Select the “DDL” language (this assumes destination model is DDL).
Select the Attribute template.
Modify the code starting about line 6, as shown below. It will be necessary to make this correction in every EA project file.
Column
{
%TRANSFORM_CURRENT("type", "stereotype", "collection", "constant", "containment", "ordered", "static", "volatile", "derived")%
name=%qt%%CONVERT_NAME(attName, "Spaced", "Pascal Case")%%qt%
%if attType == "adtTaxRate"%
type=%qt%adtTaxRate%qt%
%elseIf attType == "adtYesNo"%
type=%qt%adtYesNo%qt%
%elseIf attType == "money"%
type=%qt%money%qt%
%else%
type=%qt%%CONVERT_DB_TYPE(genOptDefaultDatabase, attType)%%qt%
%endIf%
}
This code might work to set a char(3) or varchar(11) data type:
type = %qt%varchar%qt%
length = %255%qt%