Book a Demo

Author Topic: Telling if an EA.Element is an hyperlink  (Read 6602 times)

st1led

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • in a vapor trail
    • View Profile
Telling if an EA.Element is an hyperlink
« on: January 19, 2011, 02:27:44 am »
Hello everybody!

I know that if i drag&drop a file from the windows explorer into a diagram in EA, i can create an Hyperlink to the file which will show up in the diagram. If doubleclicked, the hyperlink will open the linked file.

How can I tell, using the EA automation interface, if a given EA.Element object is an hyperlink? Debugging a small test unit I didn't find anything particular in a EA.Element object which i know is an hyperlink, besides its name (which is the file full path), and its type, which is "Text". I've also noticed that an Hyperlink generetad by drag&dropping an diagram into another is recognizable by its type attribute "UMLDiagram".  

I could assume that each EA.Element which has a name resembling a file path and has "Text" as type has an high probabilty of being an Hyperlink, but as you can imagine I'm looking for a better way to programmatically tell this case.

This time, the EA SDK reference guide didn't help me.

Any ideas?


Regards, Stefano
« Last Edit: January 19, 2011, 06:36:39 pm by st1led »
[size=9]tuesday you see
she had to be free
but somehow I got to
carry on...
[/size]

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Telling if an EA.Element is an hyperlink
« Reply #1 on: January 19, 2011, 07:49:02 am »
The hyperlink will not become an element (from t_objects) but only a diagram object (from t_diagramobjects).

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Telling if an EA.Element is an hyperlink
« Reply #2 on: January 19, 2011, 12:01:45 pm »
Quote
The hyperlink will not become an element (from t_objects) but only a diagram object (from t_diagramobjects).

q.
That's not correct q...

I create Diagram hyperlinks by setting Type to "Text",  subtype to "0" and then performing some direct DB surgery on the PDATAs.  (I don't have the code with me at the present).

Stefano, if you create a brand new hyperlink in an existing repository, and look for the last element added to t_object you should be able to see what you need to know for exactly determine if the t_object is a diagram hyperlink.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Telling if an EA.Element is an hyperlink
« Reply #3 on: January 19, 2011, 09:47:30 pm »
Please forgive me Paolo. I was just used trusting my logic and intuition after a long time not using EA. What did you say about inconsistencies?

q.

P.S.: My failure twice: Each t_diagramobject needs a t_object to get the element_id from. It's just that a number of elements do not appear in the browser.
« Last Edit: January 19, 2011, 09:52:52 pm by qwerty »

st1led

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • in a vapor trail
    • View Profile
Re: Telling if an EA.Element is an hyperlink
« Reply #4 on: January 20, 2011, 07:14:26 pm »
Quote
Quote
The hyperlink will not become an element (from t_objects) but only a diagram object (from t_diagramobjects).

q.
That's not correct q...

I create Diagram hyperlinks by setting Type to "Text",  subtype to "0" and then performing some direct DB surgery on the PDATAs.  (I don't have the code with me at the present).

Stefano, if you create a brand new hyperlink in an existing repository, and look for the last element added to t_object you should be able to see what you need to know for exactly determine if the t_object is a diagram hyperlink.

HTH,
Paolo


Thank you for you answer Paolo. I manually opened the EAP project file with a very simple DBMS (Microsoft Access) and found out that Hyperlink objects have the value "19" in the column "NType", which is also reported in the EA.Element object property "Subtype". The EA reference guide says that this is a "numeric subtype that qualifies the Type of the main element."

I wasn't able to find a map with the meaning of the numeric subtypes, besides the few examples provided in the "Subtype" attribute description: http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/element2.htm

Should I assume that each EA.Element object with "Subtype" with the value of "19" is an Hyperlink? Mind that I wasn't able to build a counterexample, that is, create a Text object in EA which is not an Hyperlink, and see if it has a Subtype value of "19" too.


Regards, Stefano



UPDATE: Dumping the database more accurately, I found out that each hyperlink also has a PDATA1 value set to 0. Even if the reference guide does not say anything about PDATA fields ("These database fields are not documented and developers must gain understanding of these fields through their own endeavors to use this property.": http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/element2.htm), I think that this could be another parameter to identify hyperlinks.
« Last Edit: January 21, 2011, 04:35:56 am by st1led »
[size=9]tuesday you see
she had to be free
but somehow I got to
carry on...
[/size]

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Telling if an EA.Element is an hyperlink
« Reply #5 on: January 21, 2011, 09:07:07 am »
Quote
Should I assume that each EA.Element object with "Subtype" with the value of "19" is an Hyperlink?
Also check Element.Type is "Text"
The Sparx Team
[email protected]