Author Topic: Connect Connector to Method  (Read 567 times)

A.K.

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Connect Connector to Method
« on: November 26, 2011, 01:44:55 am »
Hello

I have a problem with connecting a connector, in more detail a sequence, to an operation. I have investigated into all possible tables and Connector classes, but haven't found any relationships excerpt for one case. In Connector TaggedValues there is a TaggedValue holding the Operation GUID. However, creating such a TaggedValue  with the approriate name and value, has not connected the connector to the operation in the EA.

Thanks a lot!!!

Cheers

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7815
  • Karma: +171/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connect Connector to Method
« Reply #1 on: November 28, 2011, 05:43:03 pm »
Here's the code I use to get the sequence messages starting from an operation:

Code: [Select]
       /// <summary>
        /// returns all messages that call this operation
        /// </summary>
        /// <returns>all messages that call this operation</returns>
        public List<UMLMessage> getCallingMessages()
        {
            //this one we will try to find with a cunning sql query directly
            //sometimes the guid of an operation is not the same as the guid mentioned in the tag
            //to be sure the try to get both.
            string sqlQuery =
                "select c.Connector_ID  from ((t_connector c "
                + " inner join t_connectortag ct on ct.ElementID = c.Connector_ID) "
                + " inner join t_operation o on ct.VALUE = o.ea_guid) "
                + " where c.Connector_Type = 'Sequence' "
                + " and ct.Property = 'operation_guid' "
                + " and ct.VALUE = '" + this.wrappedOperation.MethodGUID + "'"
                + " Union "
                + " select c.Connector_ID  from ((t_connector c "
                + " inner join t_connectortag ct on ct.ElementID = c.Connector_ID) "
                + " inner join t_operationTag ot on ct.VALUE = ot.VALUE) "
                + " where c.Connector_Type = 'Sequence' "
                + " and ct.Property = 'operation_guid' "
                + " and ot.ElementID = " + this.wrappedOperation.MethodID;
            return this.model.getRelationsFromQuery(sqlQuery).Cast<UMLMessage>().ToList();
        }

Hope this helps

Geert

A.K.

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Connect Connector to Method
« Reply #2 on: November 28, 2011, 09:11:42 pm »
Hi

Thanks for the reply

Perhaps i was kind of misunderstanding. I have actually meant the opposite way. I have a sequence and an operation and want to connect them. I guess i could do it by bypassing the API and update the table on my own. But is their a possibility to do so with the API?

Cheers
Alex

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 7815
  • Karma: +171/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connect Connector to Method
« Reply #3 on: November 28, 2011, 09:28:23 pm »
Alex,

I knew what you meant, but this was the closest I got with my code.
I think adding the tagged value (using the api) should be enough to link the message to the operation, just make sure you use the correct operation_guid and make sure the tagged value is saved correctly.

If all that is correct then I would try to figure out what else is different in the database when you do it versus when EA does it.

Geert

A.K.

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Connect Connector to Method
« Reply #4 on: November 29, 2011, 12:08:54 am »
Hmm the behavior is kind of strange,

In some cases it works, in others not
And what is also really strange, is the fact, that the Tags have connector ids that are +10 above the "right" connector id in the connector Tag table

So we ll see
Thanks anyways