Author Topic: Same object with different stereotypes in different diagrams  (Read 7015 times)

Daniel.Serrao

  • EA Novice
  • *
  • Posts: 10
  • Karma: +1/-0
    • View Profile
Hello everyone,

I would like to know if is possible to have an object in two different diagram, where it would have different images (stereotypes) in each diagram. My goal is to represent the same goal to different stakeholders, and that goal should have a different representation for each stakeholder. As an example see the following two stereotypes:



I want to be able to change the description of one of them, and the another stereotype in another diagram would change his description to the same.

Is this possible? If yes, how can I do it?

Thanks.

qwerty

  • EA Guru
  • *****
  • Posts: 9202
  • Karma: +140/-131
  • I'm no guru at all
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #1 on: May 30, 2016, 05:42:50 am »
If you use objects they represent some concrete thing. If you re-use the same thing, it is still the same thing (with the same stereotype). If you are talking about instances, you should simply create a new instance (which results in a new EA element) that can be assigned a different stereotype.

q.

Glassboy

  • EA User
  • **
  • Posts: 945
  • Karma: +52/-61
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #2 on: May 30, 2016, 07:27:42 am »
Perhaps you just want to use the Alternate Image functionality.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6033
  • Karma: +73/-83
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #3 on: May 30, 2016, 09:49:02 am »
Hi Daniel,

You need to revise your thinking a little bit.  You want different images for the same object in different diagrams.  You DON'T want different stereotypes.

In Sparx EA you need a stereotype to trigger the shape scripting mechanism for rendering objects on diagrams to your specification.  However once you have an active script for an objects, you can control how it renders the object.  You can alter what is shown using various properties (such as on the properties page or tagged values) - but these apply to the object whatever diagram it's on.  You can respond to the diagram via a stereotype on the diagram (rare).  You can also set properties against the object on a per-diagram basis (the most likely scenario for your needs).

Look up user-selectable in query methods - to see how it works.
HTH,
Paolo
« Last Edit: May 31, 2016, 09:43:38 am by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Daniel.Serrao

  • EA Novice
  • *
  • Posts: 10
  • Karma: +1/-0
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #4 on: May 31, 2016, 05:31:05 am »
Thanks for the responses guys. Paolo you are right, what I needed was possible using the Shape editor, a simple IF which change the image of the stereotype depending on the diagram where is in. The script documentation needed was found in the "Query Methods" section in the EA User Guide.

Thanks

Sunshine

  • EA User
  • **
  • Posts: 530
  • Karma: +35/-1
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #5 on: May 31, 2016, 06:36:33 pm »
If you want to represent an object differently using shapescript here is some code that shows an achimate application component normally but if the diagram has a stereotype of "BubbleChart" then it draws a circle.
I use this for showing a TIME (Tolerate, Invest, Migrate, Eliminate) quadrant diagram for application portfolio management on a bubble chart diagram but represent the same thing as an application component on other diagrams.

Code: [Select]
shape main
{
layouttype="border";
if(hasproperty("diagram.stereotype","BubbleChart"))
{
defsize(100,100);
ellipse(0,0,100,100);
addsubshape("padding","n");
addsubshape("bubblename","center");
}
else
{
defsize(90,70); //
rectangle(0,0,100,100);
addsubshape("padding","n");
if(hasproperty("rectanglenotation","0"))
{
addsubshape("port","w");
}
addsubshape("name","center");
}

shape bubblename
{
h_align="center";
println("#name#");
}

shape port
{
preferredwidth=20;
scalable=false;
rectangle(-10,-10,10,0);
rectangle(-10,10,10,20);
}

shape padding
{
preferredheight=15;
}

shape name
{
h_align="center";
print("#name#");
}

}

decoration component
{
orientation="ne";
if(hasproperty("diagram.stereotype", "BubbleChart"))
{
return;
}

if(hasproperty("rectanglenotation","0"))
{
return;
}
else
{
rectangle(0,0,60,100);
rectangle(-10,10,10,30);
rectangle(-10,50,10,70);
}
}

Daniel.Serrao

  • EA Novice
  • *
  • Posts: 10
  • Karma: +1/-0
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #6 on: June 01, 2016, 06:41:33 am »
Thanks Sushine  ;)

Glassboy

  • EA User
  • **
  • Posts: 945
  • Karma: +52/-61
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #7 on: June 01, 2016, 07:22:06 am »
Nice shapescript.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8025
  • Karma: +183/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Same object with different stereotypes in different diagrams
« Reply #8 on: June 01, 2016, 01:28:21 pm »
We should really find a good way to share shapescripts.

I have written about 100 of them now, but they are all scattered in different profiles in different projects.
Would be nice to have one place that I can store them all, and browse them with an image and description of how they work.

Anyone have a great idea?
I've been sharing all of my code on github, but I'm not sure if that is the best way to go if we want to show an image for each shapescript as well.

Geert

Glassboy

  • EA User
  • **
  • Posts: 945
  • Karma: +52/-61
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #9 on: June 01, 2016, 01:44:53 pm »
We should really find a good way to share shapescripts.

I have written about 100 of them now, but they are all scattered in different profiles in different projects.
Would be nice to have one place that I can store them all, and browse them with an image and description of how they work.

Anyone have a great idea?
I've been sharing all of my code on github, but I'm not sure if that is the best way to go if we want to show an image for each shapescript as well.

Geert

I think github is fine for the code.  Nothing stopping there being a blog with pictures that points at Github.

Sunshine

  • EA User
  • **
  • Posts: 530
  • Karma: +35/-1
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #10 on: June 01, 2016, 04:35:27 pm »
We should really find a good way to share shapescripts.

I have written about 100 of them now, but they are all scattered in different profiles in different projects.
Would be nice to have one place that I can store them all, and browse them with an image and description of how they work.

Anyone have a great idea?
I've been sharing all of my code on github, but I'm not sure if that is the best way to go if we want to show an image for each shapescript as well.

Geert

I think github is fine for the code.  Nothing stopping there being a blog with pictures that points at Github.

Sounds like an excellent idea. Source forge could be another option. Somethings we could share;
Javascripts
Shapescripts
MDG profiles and source models
SQL
etc

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8025
  • Karma: +183/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Same object with different stereotypes in different diagrams
« Reply #11 on: June 01, 2016, 05:17:18 pm »
I've already shared all of my VBScripts and C# code on github:

https://github.com/GeertBellekens

SQL Queries is indeed a good idea as well. Got lots of those by now too.

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8025
  • Karma: +183/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Same object with different stereotypes in different diagrams
« Reply #12 on: June 18, 2016, 04:24:58 pm »
I wrote a script to export all of my shapescripts so I can upload them to github:

So now there a new repository on Github with all(most all) of my shapescripts:
https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library

The script to export them can be found here, but it works in conjunction with the other wrappers in the library:
https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Framework/Tools/Script%20Management/ExportAllShapeScripts.vbs

If you want to know how to use the vbscript library see: https://bellekens.com/2015/12/27/how-to-use-the-enterprise-architect-vbscript-library/

It's still a first rough version that needs some refactoring, but it got the job done :-\.

Geert

Viking

  • EA User
  • **
  • Posts: 247
  • Karma: +1/-2
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #13 on: July 22, 2016, 02:21:23 am »
If you want to represent an object differently using shapescript here is some code that shows an achimate application component normally but if the diagram has a stereotype of "BubbleChart" then it draws a circle. I use this for showing a TIME (Tolerate, Invest, Migrate, Eliminate) quadrant diagram for application portfolio management on a bubble chart diagram but represent the same thing as an application component on other diagrams.

I am new to this kind of thechnology. Could somebody tell me please:
- What do I have to enter in Project > UML Types > Stereotype and Base Class (and any other)?
- Could somebody change the script for me that an APPLICATION is shown with the "component"-shape in an Archimate diagram and as a swimlane in a BPMN-diagram.

Many thanks in advance

V

PeterHeintz

  • EA User
  • **
  • Posts: 628
  • Karma: +38/-14
    • View Profile
Re: Same object with different stereotypes in different diagrams
« Reply #14 on: July 22, 2016, 04:31:35 am »
Hello Viking
In the Stereotype field you have to insert the name of your stereotype you create.
In the Base Class field you have to select the UML basis type what somehow defines the features you can use later.

In the table on the right you see examples of that, e.g. a cdrom that is in fact an UML Node (at least in my installation).
Most of the stereotypes you see, use as “Override Appearance” Metafile, what is a kind of image.
As I understand, you what to have a different shape. Information how to do that, you can find on Sparx help pages or in querty’s book here:
https://leanpub.com/shapescript/read
Best regards,

Peter Heintz