Author Topic: Retrieving Association Specialisation Information  (Read 855 times)

A. Betts

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Retrieving Association Specialisation Information
« on: July 08, 2011, 09:50:54 am »
Hi All,
    Is there any way to retrieve assocation specialisation information via the automation API? I've looked in RoleTags,CustomProperties,MiscData,Properties etc. and haven't found them so far.

Any leads appreciated.

Regards,

Ashley

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8027
  • Karma: +183/-22
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Retrieving Association Specialisation Informat
« Reply #1 on: July 08, 2011, 04:40:34 pm »
Ashley,

I don't know the answer, but what I do in such cases is:
- create a new (empty) model
- add only the things that I'm interested in
- Open the database and figure out how EA stored the information I'm after
- Then try to figure out whether (or not) the API exposes that particular piece of information.
- If it's not exposed by the API I use Repository.SQLQuery() to get that information.

Geert

A. Betts

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Retrieving Association Specialisation Informat
« Reply #2 on: July 12, 2011, 11:16:08 am »
Thanks Geert, I'll have a bit of dig around when I get the chance and report back.

A. Betts

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Retrieving Association Specialisation Informat
« Reply #3 on: July 12, 2011, 02:52:11 pm »
It's in t_xref:

Behavior: redefinedProperty or subsettedProperty
Description: base assocation guid
Client: subsetting or redefining association guid

Does anyone have any examples of processing the result set from Repository.SQLQuery in VBscript or JScript (I'm a VB and JScript gumby and need help)? I assume there's some convenient way to wrap the stringified xml back up into object form?

Regards,

Ashley

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8027
  • Karma: +183/-22
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Retrieving Association Specialisation Informat
« Reply #4 on: July 12, 2011, 04:11:21 pm »
Ashley,

Here's what I use in C#. I'm sure you'll understand the idea
Code: [Select]
/// <summary>
        /// search the model using an sql query
        /// </summary>
        /// <param name="SQLQuery">the query to be performed</param>
        /// <param name="searchTerm">the searchterm to be looked for</param>
        /// <returns>a list of EA wrappers matching the required criteria</returns>
        private List<object> SearchSQL(string SQLQuery,string searchTerm)
        {
            List<object> searchResults = new List<object>();
            // add the searchTerm in the query
            SQLQuery = SQLQuery.Replace("<Search Term>", searchTerm);
            string searchResult = wrappedModel.SQLQuery(SQLQuery);
            //parse string (xml format) to find out which objects are returned
            List<string> guids = XMLParser.getTagValues(searchResult, "CLASSGUID");
            List<string> types = XMLParser.getTagValues(searchResult, "CLASSTYPE");
            for (int i = 0; i < guids.Count; i++)
            {
                object objectToBeWrapped = null;
                if (types[i] == "Attribute")
                {
                    objectToBeWrapped = wrappedModel.GetAttributeByGuid(guids[i]);
                }
                else if (types[i] == "Connector")
                {
                    objectToBeWrapped = wrappedModel.GetConnectorByGuid(guids[i]);
                }
                else if (types[i] == "Operation")
                {
                    objectToBeWrapped = wrappedModel.GetMethodByGuid(guids[i]);
                }
                else if (types[i] == "Diagram")
                {
                    objectToBeWrapped = wrappedModel.GetDiagramByGuid(guids[i]);
                }
                else
                    //must be an element then
                {
                    objectToBeWrapped = wrappedModel.GetElementByGuid(guids[i]);
                }
                if (objectToBeWrapped != null)
                {
                    searchResults.Add(EAWrapperFactory.createEAWrapper(this, objectToBeWrapped));
                }
            }
            return searchResults;
        }

Geert