Author Topic: Access profile data from AI  (Read 4155 times)

rvaldes

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Access profile data from AI
« on: July 27, 2010, 06:14:03 pm »
Hi, im trying to access stereotype info from a profile that is packed inside a MDG Technology file that is deployed from an Addin.

I have checked that the stereotypes defined in my profile are not accesible from Repository class, since the Stereotypes collection of that class returns only the stereotypes stored in the .eap file.

Any workaround for this scenario?

Thanks in advance

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8595
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Access profile data from AI
« Reply #1 on: July 27, 2010, 07:14:36 pm »
Hi,

If I understand you correctly, you'd like to access/manipulate the stereotype attributes - such as Fill colour.

This, as far as I know, is NOT possible.

Please submit a Feature Request and tell us the name,
leaving a note here to say you've done it.
We users can then vote for it using a Feature Request with the same name[/color]
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Michael Proske

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Access profile data from AI
« Reply #2 on: July 27, 2010, 11:53:54 pm »
Try to read the profile data with an xml reader from the technology file. You have to write your own addin to get access. I used these to have update my own profile data with new tagged values. if you like i can send you the c# code.

mq-EA

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Access profile data from AI
« Reply #3 on: September 14, 2010, 03:40:12 pm »
Quote
Try to read the profile data with an xml reader from the technology file. You have to write your own addin to get access. I used these to have update my own profile data with new tagged values. if you like i can send you the c# code.
How I can get available list of MDG Technology?
I fund methods:
- ActivateTechnology (string Name)
- DeleteTechnology (string ID)
- GetTechnologyVersion (string ID)
- ImportTechnology (string Technology)
- IsTechnologyEnabled (string ID)
etc. but where is information about  the technology ID?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13233
  • Karma: +553/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Access profile data from AI
« Reply #4 on: September 14, 2010, 03:52:12 pm »
Have you tried to use the "id" attribute in the xml files in C:\Program Files\Sparx Systems\EA\MDGTechnologies ?

Geert

mq-EA

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Access profile data from AI
« Reply #5 on: September 14, 2010, 06:19:18 pm »
Yes, this is it, but I want to have list of technologies from EA.
beggars can't be choosers :)
Thanks

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: Access profile data from AI
« Reply #6 on: September 15, 2010, 02:11:00 am »
Not sure if this helps, but...

EA stores imported profiles in table t_trxtypes, with the profile XML stored in the Notes (memo) field (BTW, MDA transformations, auto-counters and HTML styles are stored here as well). If the profile is imported and the original XML file isn't available, the XML can be gotten from this table.

Cheers,
Fred
Fred Woolsey
Interfleet Technology Inc.

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


mq-EA

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Access profile data from AI
« Reply #7 on: September 15, 2010, 07:16:30 pm »
I need something like that...
I activated technology in my repository and when I call select * from t_trxtypes in Model Search the result is an empty table ... Why .. ? :)
« Last Edit: September 16, 2010, 05:36:04 pm by mq-EA »

Michael Proske

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Access profile data from AI
« Reply #8 on: September 17, 2010, 11:19:22 pm »
I think it is not possible the select active technologies from a database because technologies are independent from a specific eap or database file. I think the only way to find out is to write a plugin and react on the Technology events like EA_OnPreActivateTechnology. From that point on you can load the profile data.

The following code just gives a hint how to load in the file
        public void open()
        {
            //  XmlTextReader m_handle = new XmlTextReader(m_technology);

            m_xmlDoc = new XmlDocument();
            m_xmlDoc.Load(m_technologyName);
            m_stereotypeList = new List<Stereotype>();
            XmlElement root = m_xmlDoc.DocumentElement;

            XmlNodeList profiles = m_xmlDoc.SelectNodes("//UMLProfiles/UMLProfile/Documentation");
            foreach (XmlNode profile in profiles)
            {
                XmlNodeList stereotypes = profile.SelectNodes("../Content/Stereotypes/Stereotype");
                //Select Stereotype attribute
                foreach (XmlNode stereotype in stereotypes)
                {
                    XmlNode apply = stereotype.SelectSingleNode("./AppliesTo/Apply");
                    if ((apply != null) && apply.Attributes.GetNamedItem("type").Value == "ToolboxPage") continue;
                    Stereotype st = new Stereotype();
                    st.Technology = profile.Attributes.GetNamedItem("name").Value;
                    st.Name = stereotype.Attributes.GetNamedItem("name").Value;
                    if (apply != null) st.Apply = apply.Attributes.GetNamedItem("type").Value;
                    try
                    {
                        st.Generalize = stereotype.Attributes.GetNamedItem("generalizes").Value;
                    }
                    catch { }
                    XmlNodeList taggedValues = stereotype.SelectNodes(".//TaggedValues/Tag");
                    foreach (XmlNode tag in taggedValues)
                    {
                        st.taggedValues.Add(tag.Attributes.GetNamedItem("name").Value);
                    }
                    m_stereotypeList.Add(st);
                }
            }
        }

I will create a plugin project and post it here in the forum so you can play a little bit with the functinality

Michael