Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: ch on June 18, 2008, 09:14:07 pm
-
Hey,
I want to import a package from xmi-file in java. The package-structure in EA already exist (also the package, which I want to import). I've written following code:
Repository rep = new Repository();
rep.OpenFile("D:\\testproject.eap");
Collection<Package> packs = rep.GetModels();
Collection<Package> elems = packs.GetPackages();
Package importPack = elems.GetByName("test");
rep.ImportPackageBuildScripts(importPack.GetPackageGUID(),"D:\\test.xml");
If I run the program, there is an java-exception:
Exception in thread "main" java.lang.Exception: F
at org.sparx.Repository.comImportPackageBuildScripts(Native Method)
at org.sparx.Repository.ImportPackageBuildScripts(Repository.java:699)
at Main.main(Main.java:17)
Can someone help?
Thanks in advance!
-
ImportPackageBuildScripts is the wrong function.
You need Project.ImportPackageXMI.
Repository rep = new Repository();
rep.OpenFile("D:\\testproject.eap");
Collection<Package> packs = rep.GetModels();
Collection<Package> elems = packs.GetPackages();
Package importPack = elems.GetByName("test");
rep.GetProjectInterface().ImportPackageXMI(importPack.GetPackageGUID(),"D:\\test.xml",1,0);