Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: SANS Ltd. on May 20, 2015, 07:04:32 pm
-
Is there a way to do a "Get All Latest" through the COM API?
Package supports the updating against a VCS repo, but Package.Update() fails with "Element Locked" after calling Package.VersionControlGetLatest(). So new sub-packages are not read. We tried to call "GetLatest" Recursively on all packages which are stored in separate XMI files.
Here is what we tried so far (from Windows Script Host, the rest of our tool runs fine):
function updatePackage(package, parentName) {
if (package.IsControlled) {
WScript.Echo("Updating " + parentName + "::" + package.Name + " to SVN state.");
package.VersionControlGetLatest (/* boolean ForceImport */ true);
repository.ScanXMIAndReconcile();
repository.RefreshModelView(package.PackageID);
package.Update();
}
var childPackageEnumerator = new Enumerator(package.Packages);
while ( !childPackageEnumerator.atEnd() ) {
var childPackage = childPackageEnumerator.item();
updatePackage(childPackage, parentName + "::" + package.Name);
childPackageEnumerator.moveNext();
}
}
...
var modelEnumerator = new Enumerator(repository.Models);
while ( !modelEnumerator.atEnd() ) {
var currentModel = modelEnumerator.item();
updatePackage(currentModel, "");
modelEnumerator.moveNext();
}
repository.ScanXMIAndReconcile();
repository.RefreshModelView(0);
-
Hi folks,
Sparx provided a solution for this issue:
http://blog.sparxsystems.de/2015/05/2222/
Regards
Florian