Book a Demo

Author Topic: Element > InfoView: Possible to enable via script?  (Read 6185 times)

Michael Hafner

  • EA User
  • **
  • Posts: 47
  • Karma: +0/-0
    • View Profile
Element > InfoView: Possible to enable via script?
« on: November 18, 2016, 07:11:55 am »
Dear all,

it doesn't seem so, but: Is it possible to enable the "info view" of a diagram object via script?

Thank-you
Michael

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Element > InfoView: Possible to enable via script?
« Reply #1 on: November 18, 2016, 09:03:13 am »
Well, no way I know of. But if you like to dig: t_diagram.styleex has something like

OPTIONS_BEEBF13E=InfoView=7:;

for elements that have the info view turned on. Looks like part of the GUID. I'll look into that in more detail tomorrow.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Element > InfoView: Possible to enable via script?
« Reply #2 on: November 20, 2016, 04:49:23 pm »
Michael,

(Almost)Everything can do, we can simulate somehow using scripting.
In this case the property doesn't seem to be exposed to the API, but there's always a backdoor.
Since EA stored everything in the database you can edit the database to ge the results you require.
That is a dirty dangerous workaround, but sometimes you don't have another option.

The trick is to execute an SQL update query using Repository.Execute (which will not show up in the documentation or intellisense, but is actually there and will work)

Jut be aware that once you go down this path you are on your own (except for us here on the forum) and shouldn't expect any support from Sparx regarding this type of script.

Geert

Ian Mitchell

  • EA User
  • **
  • Posts: 507
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: Element > InfoView: Possible to enable via script?
« Reply #3 on: February 17, 2022, 09:28:02 pm »
This is an excellent bit of EA to reverse-engineer.
The number which appears after the InforView=
is some kind of integer conversion of the binary choices in the Info View properties dialog,
with Icon = first bit, type = 2nd, stereotype=3, status=4 phase = 5, version =6, author = 7...etc taggedValue = 9
Hence the default is 7 = BIN 000111 which is icon, type and stereotype.
Some of the higher-order bits may be flipped, however, so the best way to set the default you want is to
set it in the UI, and inspect the database (in t_diagram.styleEX, as Geert said)
For example, I wanted my default to be tagged-values and stereotype, which is DEC 16645, 0b100000100000101,
which makes no sense....

EA also doesn't seem to care if you just append the 'make this element an Info View' onto the end of the StyleEx string, like:
OPTIONS_BF1367B4=InfoView=16645:;
...where the BF1367B4 is the DUID from t_diagramobjects.objectStyle.
Simple!
« Last Edit: February 17, 2022, 09:32:42 pm by Ian Mitchell »
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Element > InfoView: Possible to enable via script?
« Reply #4 on: February 17, 2022, 09:44:12 pm »
Ha bitmasks, fun fun fun  :)

Had to do something similar for decoding options in Active Directory for the property UserAccountControl
Now luckily Microsoft has documented each of their options, so no need to reverse engineer the values using trial and error https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/useraccountcontrol-manipulate-account-properties

I had to read those values in a script, so I started by defining each of the property values as a constant

Code: [Select]
const uac_SCRIPT = 1
const uac_ACCOUNTDISABLE = 2
const uac_HOMEDIR_REQUIRED = 8
const uac_LOCKOUT = 16
const uac_PASSWD_NOTREQD = 32
const uac_PASSWD_CANT_CHANGE = 64
const uac_ENCRYPTED_TEXT_PWD_ALLOWED = 128
const uac_TEMP_DUPLICATE_ACCOUNT = 256
const uac_NORMAL_ACCOUNT = 512
const uac_INTERDOMAIN_TRUST_ACCOUNT = 2048
const uac_WORKSTATION_TRUST_ACCOUNT = 4096
const uac_SERVER_TRUST_ACCOUNT = 8192
const uac_DONT_EXPIRE_PASSWORD = 65536
const uac_MNS_LOGON_ACCOUNT = 131072
const uac_SMARTCARD_REQUIRED = 262144
const uac_TRUSTED_FOR_DELEGATION = 524288
const uac_NOT_DELEGATED = 1048576
const uac_USE_DES_KEY_ONLY = 2097152
const uac_DONT_REQ_PREAUTH = 4194304
const uac_PASSWORD_EXPIRED = 8388608
const uac_TRUSTED_TO_AUTH_FOR_DELEGATION = 16777216
const uac_PARTIAL_SECRETS_ACCOUNT = 67108864

Then given a certain value for this property in Active Directory we can use this function to figure out if it's set or not by doing a bitwise AND, and comparing the result

Code: [Select]
Public Function hasUserAccountControlProperty (propertyConstant)
dim result
result = me.UserAccountControl AND propertyConstant
dim containsKey
if result = propertyConstant then
hasUserAccountControlProperty = true
else
hasUserAccountControlProperty = false
end if
end function

So I now have nice and clean properties in my vbscript class such as

Code: [Select]
Public Property Get isDisabled
isDisabled = me.hasUserAccountControlProperty(uac_ACCOUNTDISABLE)
end property

I guess you could do exactly the same thing with the infoview properties

Geert