Screwtape
Screwtape

Reputation: 1367

How to document only attributes displayed on a class diagram?

I have a class diagram showing tables and the relations. The tables have been restricted on the diagram to show only the attributes I'm interested in, using the "custom" button in the Feature Compartment Visibility dialog. I now want to use the document generator to document the classes and attributes displayed on the diagram in the document text.

Suppress Displayed Attributes Dialog

While I can use a virtual document with the appropriate query to select the classes in the diagram, passing that into a template which shows the attributes shows all of them. I can't find a way of reducing the list of attributes.

I could use a template to show the class header, and a custom fragment to query the attributes, but it would not be possible to determine within the custom script/sql which diagram was the relevant one, so that doesn't work.

Has anyone managed to do this without a third party tool?

Upvotes: 1

Views: 933

Answers (2)

Geert Bellekens
Geert Bellekens

Reputation: 13784

You can get that info in the field StyleEx of the t_diagram The following example query returns the attributes that are shown on a particular diagram

select a.ea_guid,d.StyleEx from t_diagramobjects do
inner join t_object o on do.Object_ID = o.Object_ID
inner join t_diagram d on d.Diagram_ID = do.Diagram_ID
inner join t_attribute a on o.Object_ID = a.Object_ID
where o.ea_guid = '{0285FC6A-A2CE-479e-B374-5135BD74DACF}'
and d.StyleEx like '%SPL=S_%' + substring(a.ea_guid,2,6) + '%'

This works for SQL-Server, but needs to be adapted to suit your DBMS as substring and wildcards are database specific.

Upvotes: 2

Mart10
Mart10

Reputation: 794

You can set a Scope on the attribute so they will be shown dependent of the scope, for example, your diagram can show only all public attributes. You can then go into the Diagram Properties, on the features tab, and select which scopes you want to show

1]

Or

You can set a stereotype, for example NotVisible, on an attribute you want to hide.

You then need to go in the feature visibility of each element, and enter the stereotypes you want to hide in the box in the bottom

enter image description here

There are other ways, but this is the gist of it

After that you can use fragments and query on attributes with the defined scope or stereotype

Upvotes: 0

Related Questions