Book a Demo

Author Topic: Link between class operation and message  (Read 6295 times)

V.Wilmet

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Link between class operation and message
« on: July 19, 2012, 09:05:54 pm »
My question is quite simple :
How to find in wich sequence diagrams an operation of a class is used in a message ?

I've tried with matrix relationship without success... Is somebody can help me ?

V.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Link between class operation and message
« Reply #1 on: July 19, 2012, 10:41:33 pm »
Recently Ctrl-U (find in all diagrams) also works for operations (I think version 9.x)

This question was also the main reason why I started with the EA Navigator addin.

Geert

V.Wilmet

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Link between class operation and message
« Reply #2 on: July 20, 2012, 12:37:22 am »
Thanks.
You're right but... it works only if, in the sequence diagram, you have a link to the class element. If you have an instance of the class (as I did in all my sequ. diag.), it doesn't work :( :( :(

Is there another trick in EA to  to get the trace between operation and message adressed to an instance ?
And, if not, is your addin resolving this problem ?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Link between class operation and message
« Reply #3 on: July 20, 2012, 12:43:43 am »
My addin does yes.

Geert

V.Wilmet

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Link between class operation and message
« Reply #4 on: July 20, 2012, 12:48:48 am »
Correction : It works also with instances of a class. But not with mine. Only with new ones ...  Mystery... Mystery...

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Link between class operation and message
« Reply #5 on: July 20, 2012, 01:01:03 am »
Hmm, yes, I think there are two ways in which an operation was linked with a message, old and new. At some point they apparently changed the way to link them.
The EA Navigator supports both I think.

There's a piece of code in the Operation.GetCallingMessages that does:
Code: [Select]
//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 sqlCallingMessages =
                @"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 in ('Sequence','Collaboration')
                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 in ('Sequence','Collaboration')
                and ct.Property = 'operation_guid'
                and ot.ElementID = " + this.wrappedOperation.MethodID;
to counter this problem.

Geert

V.Wilmet

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Link between class operation and message
« Reply #6 on: July 20, 2012, 01:04:47 am »
Thanks Geert for your tool. I'm not shure to have catched all its possibilities, but it seems to be helpfull. Unfortunately it does not solve my problem. I guess that the trace between the messages on class instances and the class operations is lost for an unfnown reason... I certainly did something wrong but what and when ...

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Link between class operation and message
« Reply #7 on: July 20, 2012, 01:58:17 am »
Yes, that sometimes happens, that you loose the link between the actual operation and the message. All that then remains is the name of the operation on the message.
I think I have an SQL Search somewhere that finds diagrams based on the message(operation) name.
I'll post it tomorrow.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Link between class operation and message
« Reply #8 on: July 20, 2012, 03:02:58 am »
Try this one:
Code: [Select]
 o.ea_guid As CLASSGUID, o.Object_type As CLASSTYPE,
  'Behaviour' As Usage, o.name As ElementName,
  o.Object_Type As ElementType, o.stereotype As ElementStereotype,
  '' As Diagram, o.ea_guid
FROM t_operation op,  t_object o
WHERE
  op.EA_GUID = '<Search Term>'      AND      
#DB=JET# op.Behaviour = o.EA_GUID #DB=JET#                  
#DB=ORACLE# Cast(op.Behaviour As Varchar2(38)) = o.EA_GUID #DB=ORACLE#

#DB=ORACLE#
/* --- Find State Operation from Class operation (do,entry,exit) --- */
#DB=ORACLE#
UNION
SELECT
  op.ea_guid, 'Operation', 'Operation Class<--> State', op.name,
  Type, op.stereotype, '', op.ea_guid  
FROM  t_operation op
WHERE
#DB=JET# op.Behaviour = '<Search Term>' #DB=JET#
#DB=ORACLE#
  Cast(op.Behaviour As Varchar2(38))  = '<Search Term>'
#DB=ORACLE#

#DB=ORACLE#
/* --- Find Class Operation from State operation (do,entry,exit) --- */
#DB=ORACLE#
UNION
SELECT
  op.ea_guid, 'Operation', 'Operation Class<--> State', op.name,
  op.Type, op.stereotype,'', op.ea_guid
FROM  t_operation opState, t_operation op
WHERE
  opState.ea_guid = '<Search Term>'  AND
#DB=JET# opState.Behaviour = op.ea_guid #DB=JET#
#DB=ORACLE# Cast(op.Behaviour As Varchar2(38)) = op.ea_guid #DB=ORACLE#

#DB=SQLSVR#
/* --- Find Call Action -------------------------------------------- */
#DB=SQLSVR#

UNION
SELECT
  o.ea_guid, o.Object_Type, 'Call Action', o.name,
  o.Object_Type, o.stereotype,'', o.ea_guid
FROM t_operation op,  t_object o
WHERE
  o.Classifier_GUID = '<Search Term>'
AND  o.Classifier_GUID = op.ea_GUID

#DB=SQLSVR#
/* --- Find return type of method----------------------------------- */
#DB=SQLSVR#
UNION
SELECT
  o.ea_guid, o.Object_Type, 'ReturnType', o.name,
  o.Object_Type, o.stereotype,'', o.ea_guid
FROM t_operation op,  t_object o, t_object o1
WHERE
    op.EA_GUID = '<Search Term>' AND
#DB=JET# Format(o.Object_ID) = op.Classifier #DB=JET#
#DB=ORACLE# o.Object_ID = op.Classifier #DB=ORACLE#
#DB=SQLSRV# Usage in Sequence Diagram #DB=SQLSRV#
AND op.object_id = o1.object_id

UNION
SELECT
  c.ea_guid, c.connector_type, 'Sequence', c.name, 'Operation',
  o.stereotype,d.name, c.ea_guid
FROM
  t_connector c, t_object o, t_operation op,
  t_diagram d, t_diagramlinks dl
WHERE
  c.end_object_id = o.object_id AND o.object_id = op.object_id AND
  '<Search Term>' = op.ea_guid AND dl.diagramID = d.diagram_ID AND
  dl.connectorID = c.connector_id

UNION
SELECT
  c.ea_guid, c.connector_type, 'Sequence', c.name,
  'Operation',  o.stereotype, d.name, c.ea_guid
FROM
  t_connector c, t_object o1, t_object o, t_operation op,
  t_diagram d, t_diagramlinks dl
WHERE
  c.end_object_id = o1.object_id AND o1.object_id = o.object_id AND
  o.object_id = op.object_id AND '<Search Term>' = op.ea_guid AND
  dl.diagramID = d.diagram_ID AND dl.connectorID = c.connector_id

Order By 3,4

You need to create a search with the SQL builder. Type "SELECT " manually and paste the rest of above SQL (somehow pasting a whole SQL confuses EA...). In this form you must supply the ea_guid of the operation for the search.

q.
« Last Edit: July 20, 2012, 03:03:53 am by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Link between class operation and message
« Reply #9 on: July 20, 2012, 03:35:21 pm »
Here's the search I use:

Code: [Select]
select distinct d.ea_guid as CLASSGUID,d.Diagram_Type as CLASSTYPE,d.name as Name
,package.name as Package_Nam ,package_p1.name as Package_level_1
,package_p2.name as Package_level_2,package_p3.name as Package_level_3
from (((((t_connector c
inner join t_diagram d on c.diagramID = d.diagram_id)
inner join t_package package on d.package_id = package.package_id)
left join t_package package_p1 on package_p1.package_id = package.parent_id)
left join t_package package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package package_p3 on package_p3.package_id = package_p2.parent_id)
where c.name like '#WC#<Search Term>#WC#(#WC#)'
and d.Diagram_Type = 'Sequence'

Geert
« Last Edit: July 20, 2012, 03:35:44 pm by Geert.Bellekens »

V.Wilmet

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: Link between class operation and message
« Reply #10 on: July 20, 2012, 11:55:46 pm »
Yeah... Powerful. Thank you very much to all of you. ;-)