Book a Demo

Author Topic: Imported package XMI as a root node/Model  (Read 5782 times)

Kezia

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Imported package XMI as a root node/Model
« on: November 11, 2007, 11:57:51 pm »
Hi,

It seems that ImportPackageXMI method can only works when the imported package is under another package. Can I have the XMI imported package as a root node/Model? If yes, please tell me how.
(The ImportPackageXMI have a parameter PackageGUID, it make me impossible to import an package as a root node)

Cheers,
Kezia

franchox

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Imported package XMI as a root node/Model
« Reply #1 on: November 12, 2007, 04:55:47 am »
You can use for example:
r.GetProjectInterface().ImportPackageXMI(r.GetModels().GetAt((short) 0).GetPackageGUID(), "c:\\EA\\pepe.xml", 1, 0);

It was made using JAVA API... with this example you will be able to import a package/model from an XMI to an empty .eap file.

Cheers,


Kezia

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Imported package XMI as a root node/Model
« Reply #2 on: November 12, 2007, 06:41:39 pm »
Have you tried those code? is it successful?
I'm using .Net (C#) and my code like these :

repository.GetProjectInterface().ImportPackageXMI(((EA.Package)(repository.Models.GetAt(0))).PackageGUID, xmiPath, 1, 0);

It didn't work because there is no model, and we want to get model with index 0.
Anyway, thanks :)

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Imported package XMI as a root node/Model
« Reply #3 on: November 13, 2007, 04:19:50 am »
Folks,

I wonder if this is a bug with model imports when there is only a single root.

EA enforces a 'rule' that there must be a project root, even if there is nothing else in the project. It seems that EA 'protects' this initial node from deletion. More specifically, although I can create additional root nodes, I cannot ever delete the first such node that EA provided when the project was created. [I can rename the node, just like any other root node, but only root nodes added later can be deleted.]

Please try the following experiment, to help characterize the problem, and see if it is a bug or a 'feature.'
  • In your empty model, create another root node. [To do this, right-click the current root node in the Project Browser, and from the context menu choose New Model (root node).]
  • Attempt your import with the code you've been using, but change the index of the target node to ...Models.GetAt(1)...
Please let us know if it works.

If it does work, please also report this directly to Sparx as a bug. My premise here is that if you can import to one of the other root nodes, but not to the default root node, something is broken in the default case. [You might want to report this as a bug even if it does not work. The 'feature' itself seems to be a bug.]

You can make a bug report via the Report a Bug link below the Support link at the bottom of any forum page. Please quote the title of this thread, and paste in the URL of your post with the results of the above experiment.

IMHO, this should work for any root node. In particular, since a majority of models have only the default single root, it is most important that it work in that case.

David
No, you can't have it!

Kezia

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Imported package XMI as a root node/Model
« Reply #4 on: November 14, 2007, 08:52:48 pm »
Hi,
I have tried your suggested way.
But it still didn't work. The imported package is still located under the root node.

I think it is because we search for packageGUID by command ...Models.GetAt(1)..., so when we put pakageGUID of model with index 1 to the ImportPackageXMI method, the imported package XMI is also put under the root node of model with index 1. It is the same way we do with the index 0.

Maybe, there is should be an option whether we want to override node??

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Imported package XMI as a root node/Model
« Reply #5 on: November 15, 2007, 06:59:50 am »
Well, now is the time to make a feature request, or bug report if you prefer.

As I mentioned, use one of the links at the bottom of any forum page to make your report. Remember to attach a compressed version of your sample project, as well as your XMI file. Tell Sparx exactly the steps you followed.

You're the one who should make the submission, since only you have the precise feel for what's going on.

All the best,
David
No, you can't have it!