Book a Demo

Author Topic: Adding ScenarioExtensions  (Read 5101 times)

bctm

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Adding ScenarioExtensions
« on: January 08, 2013, 09:34:40 pm »
Hi,

I'm trying to create a new UseCase with different scenarios with my C# AddIn . While it isn't a problem adding new scenarios, I can't figure out how to link them.

A short example:
I have the "main flow" and the "alternative flow". The main flow has 5 steps, the alternative 3. Both scenarios exist and now I want to link the alternate route, beginning on (mainflow) step 2 and return on step 4.

If I understood correctly, I'll fetch the ScenarioStep number 2 of my mainflow Scenario. Then I will call
Code: [Select]
ScenarioExtension extension = (ScenarioExtension)entryPoint.Extensions.AddNew(alternativeFlow.Name, "ScenarioExtension");and everything should work just fine. But sadly, I'm getting the following error message: "Scenario specified by type argument not found"

I've updated / refreshed the UseCase and it's Scenario collection as well as the scenarios / steps themselves. But it does not make any difference.

Do you have any ideas? To be honest, I'm quite lost.

Thank you in advance!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Adding ScenarioExtensions
« Reply #1 on: January 08, 2013, 09:43:54 pm »
From the documentation of ScenarioStep.Extensions:
Quote
A collection of ScenarioExtension objects that specify how the scenario is extended from this step. The arguments to AddNew should match the name and GUID of the alternative scenario being linked to.
So you should do something like
Code: [Select]
ScenarioExtension extension = (ScenarioExtension)entryPoint.Extensions.AddNew(alternativeFlow.Name, alternativeFlow.ScenarioGUID);
Geert

bctm

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Adding ScenarioExtensions
« Reply #2 on: January 09, 2013, 12:17:52 am »
Thank you very much!

Where can I find this documentation you speak of? The user guide doesn't provide this information.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Adding ScenarioExtensions
« Reply #3 on: January 09, 2013, 12:22:45 am »
Quote
Thank you very much!

Where can I find this documentation you speak of? The user guide doesn't provide this information.
It does, that's where I copied it from.
The title of the page is: ScenarioStep Class

Geert

bctm

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Adding ScenarioExtensions
« Reply #4 on: January 09, 2013, 02:29:28 am »
Thanks again, obviously I missed that piece.

Now I do have another problem - I've created the extension and it links to the right scenario, but I have a problem with setting the level for the extension. I can set the "Join" part, but the EA ignores my value for the position attribute.

I'm setting the position of the extension to "1" for example, then I'm performing an update and the level attribute will return "1a" via the API. Sounds pretty good, but if I'm taking a look at the Scenario tab of my Use Case in the EA GUI, it will always show me the position of the last step + a.
For example: If I have 5 steps and I'm setting the position to 1, the GUI will show "5a", while the API call directly after editing will return "1a".

First I thought that this may be an updating issue, but I'm updating all scenarios and their steps/extensions, as well as the use case itself.

Thanks for your help!

bctm

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: Adding ScenarioExtensions
« Reply #5 on: January 16, 2013, 01:08:53 am »
I figured out how to solve / work around the issue:

The main problem was the weird handling of lists in EA.
First, I've created all the steps in the main flow, then I've created the alternate scenario and it's steps.
At last, I've updated the according step in the main flow - which changed the order of the steps in the list! The updated step was moved to the end of the list (as if the EA deletes, changes and reinserts the element?).

An example:
Step 1, Step 2, Step 3 are available for the main flow (in exactly this order).
After updating step 2, the order was changed to: Step 1, Step 3, Step 2

My solution is to attach the alternate scenario immediately, which means that I have to create all alternate / exception flows before I'm creating the main flow. But this way I won't have to deal with EA's strange behaviour. Perhaps there's something I still missed and another, more viable, option is available. But on the other hand nobody answered my post.

Just hoping I could help somebody else who stepped into that trap.

Thanks for your help.