Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: PiotrS24 on February 06, 2020, 07:07:21 pm

Title: How to make own type list (string, number, date ...)
Post by: PiotrS24 on February 06, 2020, 07:07:21 pm

I'm working on a model to describe the frontend application written in typescript
Because in this language the main data types are:
boolean, string, char, number ...
then I wanted to make my type declaration for this metamodel
At the moment I only found the option configure / settings / coding datatypes where I can define my own language and set it in packages - and it works for me. However, such a language is not included in the MDG model

Ideally, declare your own type list for class attributes
in this area I found in the documentation:
https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/supportedattributes_2.html
_defaultAttributeType where I can set the default type of the given attribute, e.g. string
instead, I wanted to use the _metatype attribute on the class tribute
by connecting an enuma to it.
I failed - that is, after expanding the Type clom, I still see the default attributes from the language in the attributes

How to achieve your own type list using MDG, if possible or maybe do I something wrong?
my diagram looks like:
https://drive.google.com/open?id=1Vyhnj_Dc_HiYqtCchWPHb3Ndba3UVoqd (https://drive.google.com/open?id=1Vyhnj_Dc_HiYqtCchWPHb3Ndba3UVoqd)
Title: Re: How to make own type list (string, number, date ...)
Post by: Uffe on February 06, 2020, 10:58:18 pm
Hello Piotr,


If you define a set of datatypes for a source language, you can include them in an MDG Technology.

In the MDG Technology wizard (https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/creatingmdgtechnologies.html) these definitions are referred to as "Code Modules" (step 7), details here (https://sparxsystems.com/enterprise_architect_user_guide/14.0/modeling_tools/addingcodemodulesinmdgtec.html).

The Language property of an element is not defined by its stereotype. The same stereotyped class can be set -- and changed -- to any one of the available languages. The Language property is set during element creation based on what's set in the diagram's properties (Elements section of property dialog).

For a custom diagram type, you can specify what the Language property should be set to by default for diagrams of that type. Using the profile helper, it's in the Elements section (Default Language), or you can specify a metaclass attribute styleex with the initial value DefaultLang=typescript;

So if you create your own Class diagram type and set its default Language property, classes created in those diagrams will get the right Language property, and the available attribute types will be the ones you've defined.

HTH,


/Uffe
Title: Re: How to make own type list (string, number, date ...)
Post by: PiotrS24 on February 07, 2020, 02:03:17 am
Thanks a lot
that's what I needed.

I really thank you, I'm going to implement it  :D

I will let you know the results
Title: Re: How to make own type list (string, number, date ...)
Post by: PiotrS24 on February 07, 2020, 02:45:26 am
All works fine
thanks very much
this is result for another people ...
https://drive.google.com/file/d/1X2FOqB7hLBJGgOCc-mB1YxcngkSQ79yU/view?usp=sharing (https://drive.google.com/file/d/1X2FOqB7hLBJGgOCc-mB1YxcngkSQ79yU/view?usp=sharing)