Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Geert Bellekens on May 19, 2025, 07:35:45 pm

Title: How to define the default Language for my stereotype?
Post by: Geert Bellekens on May 19, 2025, 07:35:45 pm
I'm building an MDG for modelling Data Contracts

So I have a stereotype DC_Model based on a class.
Attributes (steretoype DC_Field) have a datatype that is limited to this list: https://datacontract.com/#data-types (https://datacontract.com/#data-types)

So I added a new "Product" for Data Contract, and added all of those datatypes ad code engineering datatypes.
That works well, if I set the language to "Data Contract" I can select the datatype for the attributes from my list of datatypes.

The thing I'm looking for is how to set the default language of my steretoype to my language.
I don't see any property that I can use to fill in the language.

I suspect it must be possible in an MDG since ArcGIS seems to be able to do it. Unfortunately that MDG is one of the "internal technologies" and not in plain xml format, so I can't check how they did it.

One thing I was thinking was to use a pattern instead of a simple stereotype in the toolbox, but I hope there is an easier solution.

Geert
Title: Re: How to define the default Language for my stereotype?
Post by: Takeshi K on May 20, 2025, 09:37:44 am
I have not tried, but adding an attribute _gentype to the Metaclass object (not a Stereotype object) might help.
Title: Re: How to define the default Language for my stereotype?
Post by: Geert Bellekens on May 20, 2025, 04:15:03 pm
I have not tried, but adding an attribute _gentype to the Metaclass object (not a Stereotype object) might help.
Will try and let you know.

For now my workaround is to use the template package to set the language.

Geert
Title: Re: How to define the default Language for my stereotype?
Post by: Geert Bellekens on May 20, 2025, 07:45:33 pm
Unfortunately the _gentype (or _genType) attribute didn't work.

So I'm stuck with the project template package workaround.

Geert
Title: Re: How to define the default Language for my stereotype?
Post by: Takeshi K on May 21, 2025, 11:14:00 am
If I understand correctly, the _gentype works fine for me.

1. define a new code language 'Data Contract' and add some data types for the language
2. create a profile package, then add a 'Class' metatype object
3. add an attribute _gentype and set its initial value to 'Data Contract'
4. add a 'DC_Model' stereotype object and connect them by an Extension connector
5. generate a profile from the package
6. create a new 'DC_Model' object, the language is set to 'Data Contract'

Similar to the template package, using the 'Default Language for Code Generation' option in the model options could be a solution to specify the default language.
Title: Re: How to define the default Language for my stereotype?
Post by: Geert Bellekens on May 21, 2025, 02:28:33 pm
Ah, might be a version thing. My client is still on v15.2

I'll try the same on v17.1

Geert