Author Topic: Perform GetAllLatest using the Java API  (Read 4480 times)

Ralf Ellner

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Perform GetAllLatest using the Java API
« on: June 03, 2014, 07:40:59 pm »
Hello,

I'm trying to update a large model using the Java automation interface. At the moment, I have to traverse the package tree manually and perform a Package#GetLatest() on each package since there is no operation GetAllLatest() available.

The traversal is extremely cumbersome and slow. This is due to the fact that EA deletes the content of the Package from the database and them imports the contents from the XMI file upon GetLatest(). This leaves the original Package object unusable, e.g., iterating over GetElements() or GetPackages() fails because database IDs seem to have changed (GUIDs remain stable though).
 
As a workaround I've reloaded the whole Repository (Project#Reload()) after each call to GetLatest(). Then, I queried the Repository for the Package using its GUID. This workaround seems to work. However, it is slow and each reload seems to produce a memory leak. With our large model we reach the maximum available memory and the update fails.

Another problem with the Java API is that Repository#ScanXMIAndReconcileModel() seems to be missing. Thus, some references were broken when updating the model as described above.

Do you have any suggestions how to perform GetAllLatest() using the Java automation interface?

Best regards,

Ralf