Author Topic: JScript, sequence diagrams, alternate and optional partitions. HELP!  (Read 3626 times)

anton.chertok

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Hi All,
I am building a sequence diagram using JScript, I can make the actors, and the control flows, but have become stumped by adding in Alternate flow and Optional boxes.

Anyone know how its done? The alternate flows need named/labeled partitions.

I did look into the DB, and noticed the partitions, labels and height are stored in the t_xref table, but they don't seem to be in any particular order, I couldnt track down any further metadata for the partitions (they do have a guid associated with them, couldn't find the ref to them).

i would assume there is some method to add them to a diagram, as there is with the connectors and such.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
« Reply #1 on: March 05, 2019, 06:44:07 pm »
Would you mind to explain in particular what you want to do? What (in your understanding) are "Alternate flow and Optional boxes"???

q.

anton.chertok

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
« Reply #2 on: March 06, 2019, 08:24:52 am »
I have linked a trivial diagram showing what I understand to be optional and alternate fragments.  Not sure how I generate these in a sequence diagram using JScript.  Have actors and control flows (connectors) working to my satisfaction.  Maybe I'll try some object dumps in EA to see if I can work it out =)

But if anyone knows about how its done, I'm all ears!


andersd7

  • EA User
  • **
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
« Reply #3 on: March 06, 2019, 04:44:43 pm »
I am doing something similar using VBScript to build a sequence diagram using PlantUML script as input.

Essentially the steps are:
  • create an Element of type InteractionFragment..
  • within the element add Partition for each condition
  • create a DiagramObject.. with the coordinates..

Excerpt of code (not complete)

Code: [Select]
set element = elements.AddNew( fragmentName, "InteractionFragment" )
element.Subtype = fragment_type(mid(script,1, i-1))
.....
dim partitions as EA.Collection
dim partition as EA._Partition

set partitions = element.Partitions
set partition = partitions.AddNew(partitionName,"Partition")    'where partition name is the condition
partition.Size=40 'default size
element.Update
.....

diagramObjectName= "l=" & layout_array (i,6) & ";r=" & layout_array (i,7) & ";t=" & layout_array (i,4) & ";b=" & layout_array (i,3)
set diagramObject = currentDiagram.DiagramObjects.AddNew(diagramObjectName, layout_array (i,1))
diagramObject.top = layout_array (i,4)
diagramObject.bottom = layout_array (i,5)
diagramObject.left = layout_array (i,6)
diagramObject.right = layout_array (i,7)
diagramObject.ElementID = layout_array (i,2)

.....
function fragment_type(script)

select case script
case "alt" fragment_type = 0
case "opt" fragment_type = 1
case "break" fragment_type = 2
case "par" fragment_type = 3
case "loop" fragment_type = 4
case "critical" fragment_type = 5
case else fragment_type = 0
end select
end function

However I am struggling with lining up sequences to fit nicely with an IntegrationFragment/Partition.  I will post  seaprately on this..

« Last Edit: March 10, 2019, 06:35:05 am by andersd7 »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
« Reply #4 on: March 07, 2019, 06:23:40 am »
I see (using the word fragments in the original post would have helped as well :-).

I can imagine that layout is an issue (I never tried that with SDs/fragments). I might have a look tomorrow.

q.

P.S. Geert already answered here: https://www.sparxsystems.com/forums/smf/index.php/topic,42441.0/topicseen.html
« Last Edit: March 07, 2019, 06:28:35 am by qwerty »

anton.chertok

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
« Reply #5 on: March 07, 2019, 08:35:13 am »
Nice, thanks everyone.  Started having some success yesterday, the extra info here and on Geert's example should get me a working system.

Funny, i'm also making a text sequence description to EA model script.  Would wonder if its been done before if 2 people are concurrently attempting it.  I am using text produced by websequencediagrams.com as my input.

Cheers  ;D

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
« Reply #6 on: March 07, 2019, 08:53:33 am »
I'd guess not. EA has some debugger link to create SDs. I never tried that. Still thinking that SD should be well though of and reduced to some minimum a machine will (right now) not be able to produce.

q.

andersd7

  • EA User
  • **
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
« Reply #7 on: March 07, 2019, 10:33:44 pm »
  I am using text produced by websequencediagrams.com as my input.

Anton,
looks simpler than what PlantUML has to offer..

I had to make a few edits to render in webseqeuncediagrams.. but this should parse into EA using my vbsrcipt..

https://www.websequencediagrams.com/#open=477934
PlantUML comparison

thanks,
David.