Book a Demo

Author Topic: requirements trace  (Read 4500 times)

dean.warren

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
requirements trace
« on: December 14, 2010, 12:17:13 am »
I require to extract details related to requirements trace. Where a requirements trace is when, for example, a requirement is dropped on to a diagram and a trace is used to associate the requirement to a component.

I have noted the trace is described in the 'Links' tab of the Component Properties.

How do I find all traces of requirement type in the model using the automation interface?

So far I am looking at the Connection class?

Thanks

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: requirements trace
« Reply #1 on: December 14, 2010, 03:10:49 am »
Hi

Assuming that you wish to start at an element and then identify the requirements realised by an element, then the following would work

public ArrayList getAllRequirements(EA.IDualElement useCase)
        {
            // Get the connectors for this use case
            EA.IDualCollection connectors = useCase.Connectors;

            ArrayList requirements = new ArrayList();

            // iterate the connectors looking for realizations and add the
            // requirement which it is the supplier to the ArrayList

            foreach (EA.IDualConnector connector in connectors)
            {
                if (connector.Type == "Realisation")
                {
                    EA.IDualElement common = currentModel.GetElementByID(connector.SupplierID);
                    if (common.Type == "Requirement")
                    {
                        requirements.Add(common);
                    }
                }
            }
            return requirements;
        }


Where currentModel is an instance of an EA.Repository class

The above code template could be adapted for, beginning at a Requirements then returning all elements realising that requirement, something, like this:

public ArrayList getAllRealisingElements(EA.IDualElement requirement)
        {
            // Get the connectors for this requirement
            EA.IDualCollection connectors = requirement.Connectors;

            ArrayList realisers = new ArrayList();

            // iterate the connectors looking for realizations and add the
            // element which it is the client to the ArrayList

            foreach (EA.IDualConnector connector in connectors)
            {
                if (connector.Type == "Realisation")
                {
                    EA.IDualElement common = currentModel.GetElementByID(connector.ClientID);
                    requirements.Add(common);
                }
            }
            return requirements;
        }


Cheers

Phil


Phil
Models are great!
Correct models are even greater!

dean.warren

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: requirements trace
« Reply #2 on: December 22, 2010, 10:26:30 pm »
Thanks Phil - by the time I read this I already gone dopwn a different avenue.

However...

I have iterated over Elements looking for Connectors whose properties were Trace and Dependancy (this give me the trace asscoiatations). I then use the Client and Supplie ID's to locate either end of the trace association. Next I filter the association ends on Components And Requirements.

What is the IDualElement and why would I use it?

Thanks
« Last Edit: December 22, 2010, 10:27:29 pm by dean.warren »