Book a Demo

Author Topic: Some Transformation questions  (Read 4438 times)

casper

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Some Transformation questions
« on: December 16, 2005, 02:50:20 am »
I wonder if the following things were possible when transforming from PIM to PSM.  I it's possible I would like to see how.

1) Define decorations to a class, which are code generated to something like
Code: [Select]

[Serializable]
Class
{
 // Implementation
}

2) Set the (member)type of a association target/source role. Type and membertype both don't work

3) Set includes on a class bases. I know I can define my packages to be imported in the include section but I dont need some packages in certain classes.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Some Transformation questions
« Reply #1 on: December 18, 2005, 01:22:49 pm »
1. This is done by adding a tagged value 'Attribute' with the value of '[Serializable]'.  So you want to generate the following in the Class part of the transformation.
Code: [Select]
Tag
{
 name="Attribute"
 value="[Serializable]"
}

2. Doesn't look like the grammar can handle this at all, so it will have to be added.

3. Not sure what you're wanting to do here.  Could you give a bit more detail?
« Last Edit: December 18, 2005, 01:25:08 pm by simonm »

casper

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Some Transformation questions
« Reply #2 on: December 19, 2005, 02:05:45 am »
Thanks Simon for your help.
About issue number 3. I would like to specify the includes for each class. So for example, I would like to add to my class that has the stereotype <<file reader>> the include system.io.
I want to add this in the transformation from PIM->PSM.
And the added stereotypes should be used in the PSM->code generation template.
I read that this has something to do with the fileImports macro. But than again I couldn't get it to work.

p.s
As I used the Attribute tagged value I noticed that quotes " with slashes don't get de-slashed in the code generation. So when I want to use something like this
Code: [Select]

[System.ComponentModel.DesignerCategoryAttribute("code")]

I use the following tagged value:
Code: [Select]

Class
{
  name="Test"
  Tag
  {
      name="Attribute"
      value="[System.ComponentModel.DesignerCategoryAttribute(\"code\")]"
  }
}


But when I code generate I end up with:
Code: [Select]

[System.ComponentModel.DesignerCategoryAttribute(\"code\")]
class Test
{

}


This behaviour isn't like the code blocks. When I use \" in code blocks they end up like quotes without the slash.
« Last Edit: December 19, 2005, 06:18:27 am by Casper »