Book a Demo

Author Topic: Can't create connectors for packages  (Read 6200 times)

thomas.kilian

  • Guest
Can't create connectors for packages
« on: April 03, 2008, 07:15:08 pm »
Help! I'm completely lost for the moment but it seems I can not create a connector for a package. Maybe I'm simply blind but here's what I did:
con = pack.Connectors.AddNew ("", "Dependency")
con.ClientID = pack.PackageID
con.SupplierID = pack.PackageID
con.Update

I tried all kinds f variations, but afterwards there is nothing.

Further: when I create a NEW package with the automation I can NOT create a new connector at all. The AddNew returns NULL.

Either I'm completely blind or I do have 2 bugs.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Can't create connectors for packages
« Reply #1 on: April 03, 2008, 07:40:36 pm »
1. The package object is not a thing to which connectors can point. I think you have to write

con.ClientID = pack.Element.ElementID

and so on to create a connector to the UML element represented by the package.

2. Maybe you have to update the new package, or the new package's parent package, or refresh the new package's parent package's package collection or something like that.  

thomas.kilian

  • Guest
Re: Can't create connectors for packages
« Reply #2 on: April 03, 2008, 08:04:12 pm »
Thanks for the fast feedback. ElementID was the trigger :)

Regarding the reload: I think I tried all that, but now with the first obstacle removed I will dig again.

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Can't create connectors for packages
« Reply #3 on: April 04, 2008, 03:05:37 am »
BTW, under the skin every t_package has a corresponding t_object and all t_connnector references are to the t_object.  Not that this is documented anywhere, of course ...  but had you known it, it might have given you a clue.  I have found that one can learn all kinds of interesting things prowling around in the underlying data structure.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Can't create connectors for packages
« Reply #4 on: April 04, 2008, 08:05:37 am »
Quote
BTW, under the skin every t_package has a corresponding t_object
Not every package.  Root node packages do not have an object.  You can't create connectors to them and more importantly, pack.Element will be NULL.  Please be aware of this when writing your code.  I'd hate for anyone to get stuck on this issue.
« Last Edit: April 04, 2008, 08:07:07 am by simonm »

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Can't create connectors for packages
« Reply #5 on: April 04, 2008, 08:30:48 am »
Nice to be informed, of course, but I can't imagine writing code that would try to make connections to the root node.