Author Topic: EA10CodGen - How to retrieve Constraints?  (Read 1915 times)

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
EA10CodGen - How to retrieve Constraints?
« on: January 19, 2013, 07:39:03 am »
After reading and trying for many hours (doing well with most other elements) I still have difficulties retrieving constraints from classes and attributes.

From the documentation i gather that constraints can be listed. But the following %list% expression returns nothing but empty strings (although I defined "test constraints" within the context, both pre- and post-process and OCL constraints):

$sConstraints = %list="Constraint" @separator="\n"%

What am I doing wrong?

// Rolf Lampa
« Last Edit: January 19, 2013, 07:39:27 am by Rolf_Lampa »
-- There's always a solution --

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 7732
  • Karma: +103/-18
    • View Profile
Re: EA10CodGen - How to retrieve Constraints?
« Reply #1 on: January 21, 2013, 08:37:38 am »
It only works for class level constraints.
Eve

support@sparxsystems.com

RIL

  • EA User
  • **
  • Posts: 142
  • Karma: +3/-0
  • -- There's always a solution --
    • View Profile
Re: EA10CodGen - How to retrieve Constraints?
« Reply #2 on: January 21, 2013, 12:06:44 pm »
Quote
It only works for class level constraints.
Ups. :(

Q: Is there any chance that you could add constraints to the CodeGen contexts of also the other model elements in EA?

The framework I intend to generate code for really goes "all the way" in terms of "executable models." This includes business rules defined in OCL. For this reason I would need support especially for States (and for operations and association ends). I have designed a "behavior machine" which evaluates definitions and constraints (OCL) in a handcrafted text file, which the application loads on startup and then interprets and executes in realtime. The handcrafted part is "not optimal", so to say. But  the concept otherwise works with "industrial strength" and has been running for many years already.  I was imagining using EA for regular state machine modeling and then to automagically generate all the behavior definitions in this text file.*

Regards,
// Rolf Lampa

*  What the definitions in the xml file really means in practice is that one can (re)define entire state machines, and even make new ones in runtime! This includes all the business rules constraining the transitions (ocl). All you do is to (re)import the text file with the statemachine definitions and off you go. No need to even restart the application server).
« Last Edit: January 21, 2013, 12:24:23 pm by Rolf_Lampa »
-- There's always a solution --