Book a Demo

Author Topic: Model Root Package API inconsistency  (Read 6223 times)

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Model Root Package API inconsistency
« on: August 18, 2016, 11:37:04 pm »
Hi guys,

I'm currently developing with EA 12.1 Build 1229.

The repository context item getter methods are somehow inconsistent for model root packages as can be seen in the following pictures.



For the "Model" root package:



For the "Bugs" normal package:



As can be seen, the context item types differ in the first case.

The million-dollar question: Is this a bug or a feature with a well-thought reason behind?

Thanks for enlightenment!
Jan
« Last Edit: August 19, 2016, 12:22:17 am by McMannus »

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Model Root Package API inconsistency
« Reply #1 on: August 19, 2016, 12:06:52 am »
Hi Jan,

be aware that there are persons who can't see you pictures (https://dl.dropboxusercontent...) because of security policies.

May be someone can give advice which way works for all.

Thanks.

Kind regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Re: Model Root Package API inconsistency
« Reply #2 on: August 19, 2016, 12:22:45 am »
-> Uploaded pictures to server!

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Model Root Package API inconsistency
« Reply #3 on: August 19, 2016, 03:16:33 pm »
Hi Jan,

in EA are three types of packages:
- Model (the roots)
- View (first level)
- 'Normal' Packages

Thomas Kilian has described it in is e-book ScriptingEA.

It's a bit confusing but it works.

The ObjectType of a model should be 'otModel'. I can't say why you get 'otNone'. I don't remember having any such issues with this topic. I'll try it on the weekend (if I remember) and come back.

May be there are some others who can say it from the top of the head.

Regards,

Helmut 


Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

McMannus

  • EA User
  • **
  • Posts: 108
  • Karma: +4/-1
    • View Profile
Re: Model Root Package API inconsistency
« Reply #4 on: August 21, 2016, 03:14:31 am »
Hi Helmut,

I know about the different package types EA has, but in any case, the two methods should return the same object type for the same thing.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Model Root Package API inconsistency
« Reply #5 on: August 22, 2016, 06:50:21 pm »
Hello,


From the above it would appear that Repository.GetContextItemType() returns otNone if the highlighted package does not have a corresponding element.

All packages (t_package in the database) have a corresponding hidden element (t_object), which holds things like stereotype. All packages, that is, except model roots. More details in my earlier posts here, here and here.

So it's possible it's by design, but the behaviour is not documented (in fact, the documentation for the two methods indicate identical behaviour) so I'd log it is a bug if I were you. For completeness, if you have the time, you can write an Add-In and check what it reports in EA_OnContextItemChanged(). That's the event that gets fired every time a new context item is selected in the GUI, so it should be consistent.


/Uffe
My theories are always correct, just apply them to the right reality.