Book a Demo

Author Topic: v15.2 - Accessing Namespace information via API  (Read 5735 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
v15.2 - Accessing Namespace information via API
« on: October 26, 2020, 05:48:34 pm »
We're playing around with the Namespace options.  Is it possible to get the "effective" namespace of an object via the API?  We can see that setting/unsetting the "Suppress Namespace" option in the ribbon will cause the associated change in the repository.  But we can't see the changes in the "Show Namespace" option for the diagram.

The "Show Namespace" option for the diagram doesn't seem to actually toggle the showing of the namespace of an item, it merely toggles the display of the lowest package name (even if the FQN option is set), regardless of whether it is supposed to suppress the namespace.

Is it possible to get a REAL FQN namespace path from EA or must we calculate it ourselves via traversal?

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: v15.2 - Accessing Namespace information via API
« Reply #1 on: October 26, 2020, 05:54:26 pm »
I think you'll have to determine the namespace package for yourself.

Once you have the namespace package, you can get the fully qualified name from the API though.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: v15.2 - Accessing Namespace information via API
« Reply #2 on: October 26, 2020, 06:02:30 pm »
I think you'll have to determine the namespace package for yourself.

Once you have the namespace package, you can get the fully qualified name from the API though.

Geert
Sorry, Geert, I'm not quite following what you're saying.

<Clarification>This is NOT about Reverse Engineering/Generating Code, it's about creating arbitrary items in REAL namespaces (which I think I first touched on a decade ago)</Clarification>

Which namespace package are you referring to?  The Namespace root?

Which is the call to return the FQN?  Sorry to be "dense", but I've had a hard day...   ;)

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: v15.2 - Accessing Namespace information via API
« Reply #3 on: October 26, 2020, 06:16:37 pm »
With "Namespace" package I mean the package that gets the red earmark after you flag it as a namespace.
It can be used to limit your searches in the construct picker.

The fully qualified name of an element can be found in the API through EA.Element.FQName

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: v15.2 - Accessing Namespace information via API
« Reply #4 on: October 26, 2020, 10:22:11 pm »
With "Namespace" package I mean the package that gets the red earmark after you flag it as a namespace.
It can be used to limit your searches in the construct picker.

The fully qualified name of an element can be found in the API through EA.Element.FQName

Geert
Thanks Geert,

A quick test using VBScript reveals that the output of EA.Element.FQName is the same as is visible on the diagram, in other words, it is NOT a fully qualified name including a namespace structure.  It merely reports the first level package (nest), regardless of any setting.

If I have a structure:
A package (namespace root)
+B package
++C package (suppress namespace)
+++D package
++++E item

I expect the FQName of E to be A.B.D.E
If I remove the property of Suppress Namespace on C then I expect the FQNanme of E to be: A.B.C.D.E

Have I miss understood the concept of Namespaces (and/or Fully qualified names)?

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: v15.2 - Accessing Namespace information via API
« Reply #5 on: October 26, 2020, 10:48:56 pm »
I think the namespaces are mostly used for code generation. They do not play a part in the FQName

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: v15.2 - Accessing Namespace information via API
« Reply #6 on: October 26, 2020, 11:14:38 pm »
I think the namespaces are mostly used for code generation. They do not play a part in the FQName

Geert
Yes, that's why it's controlled under the namespace section of the diagram properties...

(that's irony, )

Thanks for your help, Geert.  Saved me a lot of potential frustrations.

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

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: v15.2 - Accessing Namespace information via API
« Reply #7 on: October 27, 2020, 08:20:30 am »
The namespace root is the global namespace. It's name will not appear in any paths.
If I have a structure:
A package (namespace root)
+B package
++C package (suppress namespace)
+++D package
++++E item
So E should have a fully qualified name of B.D.E.
[/quote]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: v15.2 - Accessing Namespace information via API
« Reply #8 on: October 27, 2020, 09:07:36 am »
The namespace root is the global namespace. It's name will not appear in any paths.
If I have a structure:
A package (namespace root)
+B package
++C package (suppress namespace)
+++D package
++++E item
So E should have a fully qualified name of B.D.E.
Sorry, Eve, my bad. Thanks for reminding me.  It's been so long since I gave the "namespace" mechanism away as a "dud" that I'd forgotten.

Oh well, it's back to "using EA in spite of EA, not because of it".

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