Book a Demo

Author Topic: Usecase through javascript code  (Read 3691 times)

swettdj

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Usecase through javascript code
« on: July 12, 2012, 11:06:01 pm »
I'm trying to create a script to automaticate usecase's step creation but every step that I creat through javascript code is set as System step. How can I set user step?

And after, I need to create an alternative path for a determinated step,can someone explain me how do it? :o

Thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Usecase through javascript code
« Reply #1 on: July 13, 2012, 03:36:34 pm »
Hi,

Do you realise that the whole API is documented in the help file?

See http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/automation/scenariosteptype.html for a start

Geert

swettdj

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Usecase through javascript code
« Reply #2 on: July 13, 2012, 06:21:25 pm »
I had solved my problem with settig user and system step..but how set an alternative path on a step through javascript??

thanks

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Usecase through javascript code
« Reply #3 on: July 16, 2012, 05:57:42 am »
I've added a chapter about that to my Scripting book in case you are a subscriber. Here's the meta-
Code: [Select]
       alt = element.Scenarios.AddNew ("alternate", "Alternate");
        altS = alt.Steps.AddNew ("alt step1", "1");
        altS.Update();
        scenario.Update();
        scenario = element.Scenarios.AddNew ("scenario", "Basic Path");
        s = scenario.Steps.AddNew ("step1", "1");
        s.Update();
        ext = s.Extensions.AddNew ("", alt.ScenarioGUID);
        if (tilEnd) ext.Join = "";
        else ext.Join = s.StepGUID;
        ext.Update();
        scenario.Update();

q.

swettdj

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Usecase through javascript code
« Reply #4 on: July 16, 2012, 05:22:16 pm »
Thank you for reply, but I solved it friday afertnoon...but thank you very much

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Re: Usecase through javascript code
« Reply #5 on: July 18, 2012, 11:25:51 am »
Quote
Thank you for reply, but I solved it friday afertnoon...but thank you very much
so how did you solve it ...
Orthogonality rules
Position and Team disestablished, thanks austerity.
Now itinerant.

swettdj

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Usecase through javascript code
« Reply #6 on: July 18, 2012, 05:22:44 pm »
for alternative path i solved it with this source code:
Code: [Select]
st = steps.GetAt(n);
extensions = st.Extensions;
extension = extensions.AddNew("Step "+n+" Alternative flow","Alternate");
sceneAlt = extension.Scenario;
stepsAl = sceneAlt.Steps;
stepAl = stepsAl.AddNew(name,"Alternate");
.
.
.
stepAl.Update();
stepsAl.Refresh();
sceneAlt.Update();
steps = scene.Steps;
step = steps.GetAt(n1);
extension.Join = step.StepGUID;
extension.Update();
extensions.Refresh();

If you need other any other explanation write me I'm happy to help you