Book a Demo

Author Topic: traceability at attribute and method parameter lev  (Read 5057 times)

neil_albiston

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
traceability at attribute and method parameter lev
« on: November 04, 2009, 03:06:47 am »
Is it possible to find every instance where a class is used in a method or as an input or a return parameter, or as an attribute within another class?

Its easy enough if the class appears on a diagram, but I'm having problems tracing at method or attribute level through the model .

All pointers appreciated.

Graham_Moir

  • EA User
  • **
  • Posts: 749
  • Karma: +10/-15
    • View Profile
Re: traceability at attribute and method parameter
« Reply #1 on: November 04, 2009, 03:21:41 am »
Not sure this is the answer but have you tried the "Hierarchy" window ?  (View/Hierarchy).  Bring this up and then click on an element and it should show all its linkages.  (N.B. though the number of levels the hierarchy works to is set in the project options)
« Last Edit: November 04, 2009, 03:22:21 am by Graham_Moir »

neil_albiston

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: traceability at attribute and method parameter
« Reply #2 on: November 04, 2009, 04:16:07 am »
I like the View/Hierarchy window. I'll definitely use it for navigating the model from now on. Unfortunately it doesn't give me the information I am after.

I have two main questions at the moment.
1) ClassA is defined but does not appear on any diagrams. How can I find which classes use ClassA in their method signature or attributes?

2). ClassB has methodC. What is the quickest way to see which sequence diagrams invoke methodC?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: traceability at attribute and method parameter
« Reply #3 on: November 04, 2009, 04:17:18 am »
I don't think hierarchy view works.
I've written a couple of SQL searches to show me that (based on the name of the class) and I have some functions in my add-in library that do the same thing, only this time ID based.

Geert

neil_albiston

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: traceability at attribute and method parameter
« Reply #4 on: November 04, 2009, 04:23:09 am »
The SQL based search sounds like the way to go.
Where can I run SQL searches from? .... and is there a set of EA table descriptions anywhere?

 I'm happy to dig through the manuals and work this out for myself but could you please point me in the right direction?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: traceability at attribute and method parameter
« Reply #5 on: November 04, 2009, 04:28:30 am »
This is the page in the help you are looking for.
http://www.sparxsystems.com/uml_tool_guide/uml_modeling_tool_features/creating_filters.html
When I'm back at the office tomorrow I can send you an example.

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: traceability at attribute and method parameter
« Reply #6 on: November 04, 2009, 06:11:25 pm »
Here is the search definition I use to find the usages of a class as type of an attribute or parameter:
Code: [Select]
select o.ea_guid as CLASSGUID,'Operation' as CLASSTYPE,o.name as Name,p.Type as 'Type',  class.name as 'Class Name'
,package.name as 'Package Name',package_p1.name as 'Package level -1',package_p2.name as 'Package level -2',package_p3.name as 'Package level -3'
from t_operation as o
join t_operationparams as p on (o.operationID = p.operationID)
join t_object as class on (o.object_id = class.object_id)
join t_package as package on (class.package_id = package.package_id)
left join t_package as package_p1 on (package_p1.package_id = package.parent_id)
left join t_package as package_p2 on (package_p2.package_id = package_p1.parent_id)
left join t_package as package_p3 on (package_p3.package_id = package_p2.parent_id)
where p.type like '<Search Term>'
union
select a.ea_guid as CLASSGUID,'Attribute' as CLASSTYPE,a.name as Name, a.Type as 'Type',  class.name as 'Class Name'
,package.name as 'Package Name' ,package_p1.name as 'Package level -1',package_p2.name as 'Package level -2',package_p3.name as 'Package level -3'
from t_attribute as a
join t_object as class on (a.object_id = class.object_id)
join t_package as package on (class.package_id = package.package_id)
left join t_package as package_p1 on (package_p1.package_id = package.parent_id)
left join t_package as package_p2 on (package_p2.package_id = package_p1.parent_id)
left join t_package as package_p3 on (package_p3.package_id = package_p2.parent_id)
where a.Type like '<Search Term>'

PS. This SQL is written to the syntax of SQL Server. It will probably need some tweaking to work on a local eap (MS Access) file.

neil_albiston

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: traceability at attribute and method parameter
« Reply #7 on: November 04, 2009, 07:45:03 pm »
That is perfect. Thank you.

I am very surprised that this functionality is not part of the standard EA.

neil_albiston

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: traceability at attribute and method parameter
« Reply #8 on: November 04, 2009, 10:02:41 pm »
The SQL you provided ( Thank you) searches on Class names. Unfortunately I have the situation where multiple classes have the same name ( One in the analysis model, one in the Design Model, one in the implementation model etc.) and I need to work out which version is used by which classes and  scenarios.

Which attribute on t_attributes  and t_operationparams should I use? I've tried ea_guid ( pasteing in the GUID of the class I'm searching for ) but that did not seem to work?

Thank you for your help so far.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: traceability at attribute and method parameter
« Reply #9 on: November 04, 2009, 10:53:25 pm »
Ah, in that case you have to make another join between t_attribute/t_operationparams to t_object (using the regular id)
and in the where clause test for the ea_guid of the newly joined table.
I didn't need that join since the name of the type is kept redundantly on the t_attribute/t_operationparams

Geert
« Last Edit: November 04, 2009, 10:53:46 pm by Geert.Bellekens »