Author Topic: multiple stereotypes  (Read 2884 times)

shreeya

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
multiple stereotypes
« on: August 08, 2011, 07:30:44 pm »
I have been using Enterprise architect from past few months and I am a beginner.

I have modified the transformation and code generation template for c# so as to suit my requirement.as it is an ongoing task, recently I tried including the support for selecting multiple stereotypes.

Please find below the code snippets

Operation
{
%TRANSFORM_REFERENCE()%
                
      %elseIf attType == "Boolean" or attType == "Char" or attType == "DateTime" or attType == "Float" or attType == "Guid" or attType == "Integer" or attType == "Text"%
            name=%qt%$propertyName%qt%
            [highlight]stereotype="Property (Sample)"[/highlight]             %if attStereotype=="Mandatory"%
            [highlight],"Property (Mandatory)"[/highlight]      %endIf%    


I am dynamically assigning 2 stereotypes to an operation, I could see in the generated C# model the relevant stereotypes are checked in Stereotype Selector window. But when I try to read the stereotype using opStereotype, I am just getting the single value Property (Sample)

I would like to know how I check whether both the stereotypes are selected through the code in Code generation template.

I hope the above explanation is sufficient to provide me the relevant knowledge.

Thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: multiple stereotypes
« Reply #1 on: August 08, 2011, 09:14:29 pm »
Use the property StereotypeEx

Geert

shreeya

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: multiple stereotypes
« Reply #2 on: August 09, 2011, 04:10:02 pm »
Do you mean instead of using stereotype,you want me to use StereotypeEx?

i am getting runtime error when i use StereotypeEx,but as i told in my post for me stereotype property is working fine and is allowing me to control the assigning the multiple values to that property, i can see the result in the intermediate file as  stereotype=="Property (Sample)"    
           ,"Property (Mandatory)" and also in my model <<Property (Sample),Property (Mandatory)>> for the relevant attribute.but my major issue is [highlight]opStereotype[/highlight] as it is returning single value(Property (Sample))

Thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: multiple stereotypes
« Reply #3 on: August 09, 2011, 04:16:20 pm »
Hmm, the reason I suggested to use StereotypeEx is because that is the property in the API that is used to store multiple stereotypes. The Stereotype property only returns the "first" stereotype.
And for some strange reason I thought EA would apply that paradigm consistently.... silly me  :-[

Geert