Author Topic: 'Synch Tagged Values and Constraints' automated?  (Read 9989 times)

SimonMerrick

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
'Synch Tagged Values and Constraints' automated?
« on: March 14, 2008, 05:08:16 am »
Hi,

I am using the Automated Interface to add UML classes to an existing project (.eap file).

There is a stereotype in that project, which has a set of tagged values on it (these are defined in a UML profile that I imported), which I apply to my new classes in the hope that the stereotype's tagged values will then appear on my newly generated classes.

I know that the tagged values were successfully imported because when I right-click on the stereotype (in the Resources view/tree) and click on "Synch Tagged Values and Constraints" the tagged values do appear on all my stereotyped classes... but of course without this manual intervention, the tagged values don't appear on my classes... and I need to populate them during the automated process  :-/

So the Question is: - Is there a way to synchronise these tagged values via the Automation Interface?

It would be a start just to be able to access the tagged values that are set on my stereotype.

Please Help!  :(

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #1 on: March 14, 2008, 08:01:22 am »
I'm not sure Simon, but here's an idea.

How did you add your profile to your project? If it is part of an MDG Technology, there is a new way to load these. The old way is depreciated; using it sometimes causes functions to degrade.

The new way is to add the MDG Technology file to either the standard EA technologies directory, or add the path - or URL - where you keep your technology file to the set of placed EA will look upon startup.

Use the Settings | MDG Technologies dialog, and click Advanced. On the next dialog add your path by clicking the Add button. You can also force a technology to load through the API. Check the Repository methods, and don't use the one that is depreciated.

You must exit and restart EA for the change to be effective.

One last thing. When you add a package make sure your technology is 'active' in the drop-down on the standard tool bar. Or, activate it through the API.

Let me know if this solved the problem.

David
No, you can't have it!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #2 on: March 14, 2008, 09:13:29 am »
Quote
So the Question is: - Is there a way to synchronise these tagged values via the Automation Interface?
Undocumented feature...

Code: [Select]
Repository.CustomCommand("Repository", "SynchProfile", s)
where s is a string containing the name of the stereotype.
« Last Edit: March 14, 2008, 09:14:01 am by KP »
The Sparx Team
[email protected]

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #3 on: March 14, 2008, 11:28:41 am »
Paging Roy...
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #4 on: March 14, 2008, 06:44:48 pm »
Such features being undocumented can cost us a lot of time. I had already been thinking about a method for my AddIn which would read the MDG file into a DOM, look up the tagged values defined there, and add them to the elements created by the AddIn...

SimonMerrick

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #5 on: March 14, 2008, 09:18:50 pm »
Thanks for the swift responses guys, much appreciated.

David; I'm not using MDG Technologies. I think that the Repository.CustomCommand approach is the solution I am looking for here.

However when I execute that function, I get back an error message of the format: -

"Error: Unknown command: Repository.SynchProfile (MyStereotypeName)"


And of course, on inspection, the desired effect has not been acheived.

KP; have I misunderstood the semantics of your code there?

My code reads:-

Code: [Select]
Repository.CustomCommand( "Repository", "SynchProfile", "MyStereotypeName" )
I assume that the error message I'm getting, truly does mean that the interface does not understand the command (as opposed to cannot find the stereotype)...

I am coding in C++ and using EA version 7.0.817 (Corporate Edition) if that has any relevance.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #6 on: March 14, 2008, 10:13:05 pm »
This is a (completely uneducated) [/i]guess[/i], but what happens if you provide the name in the <ProfileName>::<StereotypeName> format?
No, you can't have it!

SimonMerrick

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #7 on: March 14, 2008, 10:22:17 pm »
Good shout. Sadly same result though  :(

Have now tried qualifying the name with profile.stereotype, profile:stereotype, and profile::stereotype

I'm starting to become convinced that the interface doesn't recognise the "SynchProfile" function or the "Repository" class  ;)

(More likely the function I would suspect)

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #8 on: March 14, 2008, 10:31:12 pm »
YA long shot, as long as you're sitting there...

This looks like reflection, so... What if the first parameter should be the instance name of your repository class, rather than the class name? This might make the call something like:

Repository.CustomCommand("MyRepository", "SynchProfile", "MyProfile::MyStereotype")

Yeah, I know, but why not give it a whirl? After all, it is the weekend in the Land of AUS, so you've got a couple of days before you'll hear more from that quarter.

David
No, you can't have it!

SimonMerrick

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #9 on: March 14, 2008, 10:54:07 pm »
Again good thinking, was worth a go.. same result as we both suspected  :-/

Thank you kindly for your attention/help David. I will post a resolution here if/when I manage to get it right :)

Best,

Simon

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #10 on: March 14, 2008, 10:57:38 pm »
Thanks Simon,

I was really hoping this - the undocumented function - would prove helpful when we saw it yesterday. It's a bit of a letdown to have it fall flat, just when the weekend starts down under. I guess we'll have to hold our breath for a few days.

David
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #11 on: March 15, 2008, 01:49:06 am »
I tried it with biuld 827 in an AddIn written in C#, and

Quote
Repository.CustomCommand("Repository", "SynchProfile", "MyStereotypeName");

did not return

Quote
"Error: Unknown command: Repository.SynchProfile (MyStereotypeName)"

but it simply returned

Quote
"false"

whatever this means (nothing so synchronize?).

Anyway, my profile is contained in an MDG file loaded the "new" way, and I don't know how to synchronize my elements manually either. But that's another story.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #12 on: March 15, 2008, 03:05:13 am »
Well surely this is an improvement.

We've gone from having the undocumented 'savior' function failing with an error, to having it do nothing and return a meaningless value.

Now think about this a bit. If I decide to write a bit of code that does nothing at all, the least I can expect is that it will run without throwing an error.

But wait, there's more. Now that the undocumented function does nothing the documentation, while missing, is complete.

Now that's progress!    ;)
No, you can't have it!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #13 on: March 17, 2008, 09:25:22 am »
Sorry guys, my fault   :-[

The third parameter should contain: "Profile=ProfileName;Stereotype=StereotypeName;"

EDIT: Oh, and it's new for EA 7.1...
« Last Edit: March 17, 2008, 09:46:14 am by KP »
The Sparx Team
[email protected]

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: 'Synch Tagged Values and Constraints' automate
« Reply #14 on: March 17, 2008, 09:54:19 pm »
Thanks Neil,

Of course, you should let Roy in on this secret as well, so he can work his magic.

David
No, you can't have it!