Reputation: 4047
I'm currently automating the process of importing XMI to Enterprise Architect using EA Script - JScript. I've been able to get definitions from existing packages GUID, Name, path to the package, create package.
The reference API from Sparx can be found here
Here's my current code
guid = "{3EC70CB6-28A1-40ed-ADD5-4B3AF5D89EED}"
Session.Output("GUID = " + guid);
Session.Output("GUID XML = " + project.GUIDtoXML(guid));
Session.Output("XMI file = " + svnPath + xmlPath);
result = project.ImportPackageXMI(project.GUIDtoXML(guid), svnPath + xmlPath, 1, 1);
Session.Output(result);
The following output shows that I got "Unknown package" while calling the API:
GUID = {3EC70CB6-28A1-40ed-ADD5-4B3AF5D89EED}
GUID XML = EAID_3EC70CB6_28A1_40ed_ADD5_4B3AF5D89EED
XMI file = D:\svn.xxx.com\yyy\docs\design\technical\class\Administration\SystemParameter.xml
Unknown package: EAID_3EC70CB6_28A1_40ed_ADD5_4B3AF5D89EED
I've googled for solution but google only shows about 17 results. The project Vienna in google code helps only a little.
So, does anyone know how to use ImportPackageXMI
?
Upvotes: 2
Views: 1700
Reputation: 10504
I can't tell from the information you've posted, but is it possible that you're trying to export a package from one project and import it into another?
Regardless of whether you tell EA to StripGUID, the package you import the XMI into must exist in the project, and that's what the PackageGUID specifies.
StripGUID 1
means a complete copy of the package contained in the XMI file is placed in the PackageGUID package. New GUIDs are created for all packages, elements, etc in the XMI file. In older versions of EA, this was the only way to make a deep copy of a package (Copy Package to Clipboard).
StripGUID 0
yields a few different results.
In all four cases, the PackageGUID package must already exist.
Upvotes: 2