Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: kl_seeger on May 29, 2020, 12:33:07 am
-
Hello and a good day, one of our projects is struggling with the usage and cleanup of stereotypes. They are suffering from wrongly added stereotypes from older EA-versions.
I understood from these two threads
- https://www.sparxsystems.com/forums/smf/index.php/topic,43282.msg256670.html#msg256670
- https://www.sparxsystems.com/forums/smf/index.php/topic,42491.msg252682.html#msg252682
that this can be handled in a better way with EA 15.1.
Nevertheless the maintenance raises still some questions.
The UML-type-maintenance dialog is fine and the deletion of stereotypes works, but I miss the possibility to check and/or to reset/ disassociate unwanted stereotypes that are marked as "to be deleted".
As also watched here
- https://www.sparxsystems.com/forums/smf/index.php/topic,42824.msg254135.html#msg254135 (last post)
the stereotype is deleted and can not be assigned again to other objects but the value is still assigned to the objects which have used the stereotype so far. This deleted stereotype will not be replaced by a new associated one... the new one will just be added too.
Knowing that behaviour I can run a simple model-search, sort the list by stereotypes and disassociate the stereotypes-"to be deleted" one after each other before I delete it... so far so good...
Wouldn't it be good feature to integrate such a (optional) "reset" in the delete-function or is that possible and I'm not aware of this possibility?
Is there a way to identify "orphan"-stereotypes and to remove them from the object-properties?
Thanks a lot
Klaus
-
Hi Klaus,
I'm afraid you're going to need a bit of scripting to get these things cleaned up.
Also I think you should avoid using stereotype defined in the model. The better approach is to define stereotypes in a profile and deploy them with an MDG
Geert
-
It's not quite automated, but my starting point would be a (custom sql) search like this.
select t_object.ea_guid AS CLASSGUID, t_object.Object_Type AS CLASSTYPE, t_object.Name, t_object.Object_Type as BaseType, t_object.Stereotype, t_xref.Description
from t_object, t_xref
where t_object.ea_guid = t_xref.Client and t_xref.Name='Stereotypes'
That will return every stereotyped object in the model. It can be extended to return attributes/operations/connectors as well if needed.
If you drag the Description column to the group area, you can collapse the groups for stereotypes you actually want, then do something with the elements using stereotypes you don't want. Alternatively, you can use the filter bar to search for particular stereotyped objects. eg. filter the description column for 'GUID=', to find all of the stereotypes that don't come from a profile. Or filter the same column for Name=MyStereotype to find all usages of that stereotype to make sure they all come from the same profile.
You can even use Repository.CurrentSelection in a script to bulk process your selection within the search.
-
Thanks a lot for your suggestions! I will discuss this with our model-admins.
best regards
Klaus
-
Hi,
I would like to come back on this post.
After some discussions the model admin decided to keep the task as smal as possible. They only want to clean up the objects and stereotypes which are relevant for their special service-generation-function.
They told me that in this case stereotypes are only assigned to Packages, Classes and Associations
Am I right when I say that then only the EA-tables t_object, t_connector, t_xref and t_stereotypes are relevant for analyses and perhaps needed changes or corrections??
Many thanks
-
You might also need t_package.
Each package has two records, one in t_package, and one in t_object.
Geert
-
Hi Geert,
many thanks for the hint. We will chance our luck.
best regards
Klaus