Book a Demo

Author Topic: Suppress a set of attributes in whole diagram  (Read 5640 times)

dchr

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Suppress a set of attributes in whole diagram
« on: March 23, 2015, 06:55:35 am »
Hi, I have imported a set of classes from Java code and placed them in class diagrams. I want to use automation to go through and hide a set of (up to) three common attributes on each class in the diagrams.

This would be the equivalent of going to the "Feature and Compartment Visibility" dialog on each diagram element, clicking "Custom", and checking the box next to the name of each attribute that I want to hide.

Is this possible using automation in EA v12? Ideally using JavaScript.

I have modified the "JavaScript - Recursive Model Dump Example" script to get down to the Attribute level on each element and to the DiagramObject level on each diagram, but I can't see any properties for Suppress there.

Thanks.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Suppress a set of attributes in whole diagram
« Reply #1 on: March 23, 2015, 07:24:18 am »
You can not suppress elements in a diagram. You need to remove them. EA_DiagramObjects lists all objects that appear on a specific diagram (they have an association with the relevant element). Just loop thoug EADiagram.DiagramObjects and remove everything you need.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Suppress a set of attributes in whole diagram
« Reply #2 on: March 23, 2015, 04:55:57 pm »
qwerty, don't think he's trying to hide the elements completely. (And if he was, I would also offer the possibility of element filters)

In terms of the original question... There isn't an API function to hide an individual feature on the DiagramObject class. Due to field length restrictions it's not stored in t_diagramobjects. You need to look in the Diagram class instead. Try looking at the Diagram.StyleEx field (if that's what it is called in the API)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Suppress a set of attributes in whole diagram
« Reply #3 on: March 23, 2015, 06:06:32 pm »
Yes, Simon. I wasn't reading carefully and now see that the OP want to hide attributes, not elements itself.

q.

dchr

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Suppress a set of attributes in whole diagram
« Reply #4 on: March 24, 2015, 07:15:26 am »
Thanks for the help. Using qwerty's suggestion I found I was able to delete the attributes from the model completely through scripting, which would be a reasonable fallback solution since I'm not generating code from the model.

I looked in the StyleX field in the database and there are a bunch of items packed into it, like:
SPL=S_B1A1D8=65A8BE,BD3E93,482245,7CB42D,5B60C0:S_C8B59B=6EE1EA,1AA705,0D671E:

where the data values e.g. 65A8BE are the start of t_attribute.ea_guid, so I guess that's what I'm looking for? It doesn't seem to be documented on the stylex page though, and I can only see a SetStyleX method. Will keep digging.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Suppress a set of attributes in whole diagram
« Reply #5 on: March 24, 2015, 08:54:28 am »
Yes, that's what you're after.

The page you referenced is for defining default values for an MDG technology diagram. Given you can't know the guids of attributes in advance it wouldn't make much sense to have it there.

So, a function that iterates over all the DiagramObjects -> Elements -> Attributes matching them according to your criteria. Add guids from the matches to a string, then set that on the diagram.

dchr

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Suppress a set of attributes in whole diagram
« Reply #6 on: March 24, 2015, 10:43:20 am »
Thanks Simon.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Suppress a set of attributes in whole diagram
« Reply #7 on: March 24, 2015, 10:48:15 am »
You might want to look in my Inside book. I've collected a bit of my wisdom when searching for those tidbits over a couple of years.

q.