Author Topic: AI features related to profiles  (Read 1348 times)

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
AI features related to profiles
« on: February 05, 2010, 06:49:32 am »
The following feature request was submitted:

====================================
Hi all,

There seems to be no way to access profile items from the automation interface, so I would like to request that the following features be added to the AI as methods of EA.Repository:

object NewObjectFromProfile(string profileName, string stereotypeName) – Creates and returns an instance of an object (Package, Element, etc.) based on «stereotypeName» defined in profile “profileName”. Object type can be determined by ObjectType and can be cast to the appropriate EA object. Error if profile or stereotype is not defined.

object NewLinkFromProfile(string profileName, string stereotypeName) – Creates and returns an instance of a link (connector) based on «stereotypeName» defined in profile “profileName”. Object type can be determined by ObjectType and can be cast to the appropriate EA object. Error if profile or stereotype is not defined.

int SyncStereotype(string profileName, string stereotypeName) – Synchronizes all associated model objects having stereotype «[profileName::]stereotypeName» with the features defined for that stereotype in profile “profileName”. Returns the count of objects updated. Identically named stereotypes from a different namespace (Profile) should not be affected. Error if profile or stereotype is not defined.

bool IsProfileLoaded(string profileName) – Checks whether the specified profile is loaded.

bool IsStereotypeDefined(string profileName, string stereotypeName) – Checks whether the specified stereotype is defined in the specified profile. False if not defined or profile not loaded.

bool LoadProfile(string filename), bool SaveProfile(string profileName, string FileName) – Load and save profile .xml files, respectively.

Cheers,

Fred Woolsey

============================================

The methods may require some tweaking (for example, what if the same stereotypeName applies to more than one MetaClass?)...
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.


Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6800
  • Karma: +142/-103
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: AI features related to profiles
« Reply #1 on: February 05, 2010, 10:23:10 am »
Yes, Fred, as you see in other posts, I'm experimenting with stereotypes that extend multiple metacalsses...

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: AI features related to profiles
« Reply #2 on: February 05, 2010, 10:46:50 am »
Paolo,

Apparently Sparx has been keeping secret  8-) a Repository method in the AI called CustomCommand(string class, string method, string params) (see http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1265303899) that provides among (no doubt) other things the ability to sync a stereotype with a profile. It doesn't distinguish between MetaClasses to which the stereotype applies, however...

Fred
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.


KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2640
  • Karma: +41/-2
    • View Profile
Re: AI features related to profiles
« Reply #3 on: February 05, 2010, 11:02:49 am »
Hi Fred,

All good ideas.

Instead of your suggested LoadProfile() command, have a look at implementing the EA_OnInitializeTechnologies broadcast handler (of course it means you will have to build your profile into a technology).

Your suggestions of NewObjectFromProfile() and NewLinkFromProfile() we would probably just use the existing AddNew() commands but pass in a stereotype something like "MyProfile::MyStereotype". This was discussed a while ago but I don't know if it gained any traction.

SaveProfile() is the one I would really like to see - it would allow me to create full build scripts for my technologies (and tick item 2 on "The Joel Test").
The Sparx Team
support@sparxsystems.com

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: AI features related to profiles
« Reply #4 on: February 05, 2010, 11:32:59 am »
Hi Neil,

It would be great if the AddNew(Profile::Stereotype) method also performed an auto-sync when Update() is called subsequently (maybe add an optional bool param to Update - Update([bool sync]) - to turn off auto-sync if sync = false?).

As a side note, I encountered some problems with capitalization and case sensitivity when saving and importing profiles - see http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1265316931.

Cheers,
Fred
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.