Book a Demo

Author Topic: Package Control, Get All Latest  (Read 9355 times)

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Package Control, Get All Latest
« on: November 26, 2009, 10:07:59 pm »
Hello,

I would like to implement a Get All Latest, automated during or after model load.

I have two questions:

Which interface do I have to use to be able triggering sort of this method GetAllLatest(...)?

Is there a way to call it automatically during or after loading process of the model?

I can not find the API for these topics.

Please give me some hints or links to the API topics.

Thank you.
Michael


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Package Control, Get All Latest
« Reply #1 on: November 26, 2009, 10:58:37 pm »
Michael,

You definitely can do stuff at the loading of a project, look into the broadcasted events: http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/broadcastevents.html

As for the getLatest(...), that is going to be a bit more difficult (if at all possible).
In the Package class you only have checkout, checkin, add and remove, but no getLatest.
In the ProjectInterface there is a LoadControlledPackage.
I'm not sure about this, but I think that if you issue a getLatest command directly at the VC and then perform a LoadControlledPackage, it might just have the desired effect.

Alternatively you could also do a checkout followed by a checkin for each package, but that is going to mess up your history, and will be troublesome if a package is already checked out by someone else.

If I were you I would definitely send a feature request to Sparx asking for both getLatest as getAllLatest functions in the API

Geert

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Package Control, Get All Latest
« Reply #2 on: November 26, 2009, 11:32:15 pm »
Hello Geert,

thanks to the hint of the broadcast event.
I guess that will help.

Concerning the LoadControlledPackage, I guess it won't.
As far as I know it loads the content from the database only, without
reloading the xmi content into the database before.

Thus I would expect an effect. which is not what we want.
But I will try it to clarify that.

Thank you
Michael

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Package Control, Get All Latest
« Reply #3 on: November 26, 2009, 11:41:35 pm »
Quote
Concerning the LoadControlledPackage, I guess it won't.
As far as I know it loads the content from the database only, without
reloading the xmi content into the database before.

The help file says:
Quote
Loads a package that has been marked and configured as controlled. The filename details are stored in the package control data.

Why would they be talking about a filename if it would only load the contents from the database?

Geert

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Package Control, Get All Latest
« Reply #4 on: November 28, 2009, 02:30:22 am »
Hello Geert,

yes you are right, but documentation is sometime different to real life.

Nevertheless, I was able to try it.

It seems, that it should work, but I got errors from the LoadControlledPackage call. The Documentation says, that the filename
details are stored in the package control data.

In fact it is, but only the relative path, starting from that point where the version control setting variable ends.

That means, that the loading fails, because the xml files can not be found. Does somebody know how I can EA to use the full path, including the version vontrol setting variable?

Thank you
Michael

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Package Control, Get All Latest
« Reply #5 on: November 28, 2009, 03:12:26 am »
Look like a plain and simple bug to me. I would report it, there's a good chance something simple like this gets fixed within a few weeks.

Maybe (this is  a long shot) you can read the vc-path of the package, add it to the general VC working directory path and save that to the package.
Then do the load, and then put the correct VC-path back. :-?

Geert

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Package Control, Get All Latest
« Reply #6 on: November 28, 2009, 04:03:15 am »
Hello Geert,

yes this would be the solution, but I can't see where I get the version control path, which is saved in the version controll settings.

This is my current problem.

Thank you.
Michael

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Package Control, Get All Latest
« Reply #7 on: November 28, 2009, 04:31:02 pm »
You could of course read it directly from the paths.txt
That file is always stored in the same location in the users profile:
<UserProfile>\Application Data\Sparx Systems\EA

Geert

PS. Pff boy what a workaround for something that you would expect to be readily available from the API  :-?

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Package Control, Get All Latest
« Reply #8 on: November 28, 2009, 06:38:08 pm »
Hello Geert,

thank you for your valueable help.

PS: And this is what I meant with that documentation is sometimes something different to real live.

:)

But thus, we have jobs.

Bye
« Last Edit: November 28, 2009, 09:44:56 pm by mizd »

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Package Control, Get All Latest
« Reply #9 on: November 30, 2009, 10:15:22 pm »
Hello Geert,

solving problems means having new problems.

The paths.txt contains of course the variables and their user specific content.

The problem is that the package XMI path gives you no hint, which variable is to be prefiexed to it.

Thus I have no way to trigger a reload.

:(
Michael


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Package Control, Get All Latest
« Reply #10 on: November 30, 2009, 10:51:09 pm »
Michael,

New problems -> new solutions  ;)

The variable you are looking for is stored in the PackageFlags field.
That is one of those "magic string" fields that contains name/value pairs.
What you are looking for is the
Code: [Select]
VCCFG=<identifier>That identifier corresponds to the
Code: [Select]
id=<identifier>
in the paths.txt

I'm not sure if the "PackageFlags" field is exposed through the API, but if it isn't you can still get it using the "Repository.SQLQuery" operation.

Geert

Mr. Sanders

  • EA User
  • **
  • Posts: 187
  • Karma: +0/-0
  • Dilbert for president
    • View Profile
Re: Package Control, Get All Latest
« Reply #11 on: December 16, 2009, 07:07:30 am »
Hello Geert,

due to a bug report to sparx, they accepted as a bug, that the LoadControlledPackage() is not working correctly and they track it.

Addtionaly they told me that they provide a Package.GetLatest() in EA 8.0.

Greetings and thank you
Michael

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Package Control, Get All Latest
« Reply #12 on: December 16, 2009, 06:00:45 pm »
Quote
Hello Geert,

due to a bug report to sparx, they accepted as a bug, that the LoadControlledPackage() is not working correctly and they track it.

Addtionaly they told me that they provide a Package.GetLatest() in EA 8.0.

Greetings and thank you
Michael

That's really good news.
Did they by any chance indicate or hint when the 8.0 was due?

Geert