1

I have been working with Modelio for a few weeks and I want to limit the lenghts of the data types I use, like the "string" type when I work with a Class Diagram. I want to be able to specify something in the trend of "string min(5) max(128)" or limit the value that can be entered for an integer field, so when I export the XMI file and create my database, that contstraint is included.

I tried with constraints, but the documenation does not give any examples, but only shows you screen shots of where to find the constraints dialog.

How do set I set length of attributes in Modelio?

Oshkosh1017
  • 109
  • 9

1 Answers1

1

In order to constraint an attribut, I see two ways:

  1. Use the multiplicities min and max. For example, your "string min(5) max (128)" could be see a char array with a 5 as minimum multiplicity and 128 as maximum multiplicity
  2. Use UML Constraint. UMl do not oblidge you to use a language or another so you can use English, C++0 or OCL (Object Constraint Language), it is up to you. I made a screenshot of a constraint which says that the value of the attribut constrainedInt must be lower than 128. BTW my OCL could be a little rustied... but the principle is there.

enter image description here

Red Beard
  • 3,436
  • 1
  • 14
  • 17
  • Sorry for my very late response: I will try this soon and get back to indicate whether it worked for me. – Oshkosh1017 Oct 26 '15 at 20:14
  • I tried your method #1 and I have "name [8..128]" (and others) by filling the Multiplicity min and max under Element. I then import the diagram in run import it in the Jhipster-UML generator. The constraints are not imported. The did not user method #1, since I have to yet read about OCL. – Oshkosh1017 Dec 10 '15 at 13:18
  • so the question is more what kind of model support Jhipster-UML generator!? – Red Beard Dec 10 '15 at 14:44