Book a Demo

Author Topic: Transformation Templates: constraints of classes  (Read 3463 times)

Marcus Wieschalla

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Transformation Templates: constraints of classes
« on: October 23, 2009, 11:05:35 pm »
Hi!

I fail to access constraints defined on the "Constraints" tab of the "Class" dialog in transformation templates.

Chapter 5 "Code Template Framework in SDK" of the SDK documentation mentions macro names such as "constraintName" and states that "Constraint" is a template name which may be used with the list macro.

That’s why I suspect that a line in the Class template such as

   %list="Constraint" @separator="\n" @indent="  "%

should be fine and that I should be able to transform constraints into the target model.

But how does that work? There is no template type for constraints.

I’ve tried the following but nothing has worked (no corresponding text in the intermediary file):

1) In Class template:
   %list="Constraint" @separator="\n" @indent="  "%

Custom template with type "<none>" and name "Constraint"


2) In Class template:
   %list="Class__Constraint" @separator="\n" @indent="  "%

Custom template with type "Class" and name "Constraint"

3) In Class template:
   %list="Class__Constraints" @separator="\n" @indent="  "%

Custom template with type "Class" and name "Constraint" (without "s")

4) In Class template:
   %list="Class__Constraints" @separator="\n" @indent="  "%

Custom template with type "Class" and name "Constraints" (with "s")

It would be great if someone knows how to do it.

Thanks
Marcus

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Transformation Templates: constraints of class
« Reply #1 on: October 24, 2009, 01:41:13 am »
Hi Marcus,

Not all of the fields as described in the Code Template framework of EA are accessible in Transformation templates, despite the formats look pretty much the same and the processes have almost similar behavior. Unfortunately there's no extra information about the Transformation templates' differences in EA help AFAIK.
Accessing constraints for code generation or model transformation would be a bit hard anyway, because there's not a really restricted format for their definition.

WBR
Günther

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Transformation Templates: constraints of class
« Reply #2 on: October 26, 2009, 08:48:46 am »
You will need to select a type of Constraint, not '<None>'.

Note that although transform templates can access constraint information, you currently can not create constraints using the transforms.

Also, the differences between code and transform templates are pretty much nothing.  You don't write to a file necessarily, some things only make sense in the transforms (so are documented there) and a different set of templates are provided by default.

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: Transformation Templates: constraints of class
« Reply #3 on: October 26, 2009, 08:31:58 pm »
Simon,

Quote
Also, the differences between code and transform templates are pretty much nothing.

At least that's not true for generating Transformations for State Machines (I once was told from a Sparxian here in the forum).

WBR
Günther

Marcus Wieschalla

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Transformation Templates: constraints of class
« Reply #4 on: November 05, 2009, 11:18:40 pm »
Quote
You will need to select a type of Constraint, not '<None>'.

Hi Simon

Thanks for the answer. But how do I select a type of Constraint if these are the only options available in the drop-down box?
 - <None>
 - Attribute
 - Class
 - Class Base
 - Class Interface
 - Class Parameter
 - Connector
 - Import
 - Linked Attribute
 - Linked Class Interface
 - Namespace
 - Operation
 - Parameter

Could you please give me a precise example how to access constraint information in transformation templates?

Thanks
Marcus

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Transformation Templates: constraints of class
« Reply #5 on: November 06, 2009, 09:24:13 am »
If constraint is not in that list, I suggest that the first step would be updating to a newer version of EA.