Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: anton.chertok on March 05, 2019, 12:53:53 pm

Title: JScript, sequence diagrams, alternate and optional partitions. HELP!
Post by: anton.chertok on March 05, 2019, 12:53:53 pm
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.
Title: Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
Post by: qwerty 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.
Title: Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
Post by: anton.chertok 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!

(https://lucidchart.zendesk.com/hc/article_attachments/360015687072/SupportedMarkup3.png)
Title: Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
Post by: andersd7 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:

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..

Title: Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
Post by: qwerty 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 (https://www.sparxsystems.com/forums/smf/index.php/topic,42441.0/topicseen.html)
Title: Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
Post by: anton.chertok 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
Title: Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
Post by: qwerty 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.
Title: Re: JScript, sequence diagrams, alternate and optional partitions. HELP!
Post by: andersd7 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 (https://www.websequencediagrams.com/#open=477934)
PlantUML comparison (http://www.plantuml.com/plantuml/uml/LP51Rzim38Nl-XL4UqaEk-peGz5vxe006p3C3R0hAzE9C4LoIMge__tOsidaYqsRttjwU7eKHTPoYUwBrypG-pCD9I832lIkpIKDo3FS7OKO3ac9H_Ha71EbktVgU83x64vdVOc5tDUSb7E4zHs9wssRtw2VHUa2zoEDusTqFv4r-31XKcXhjaF55nI2su02tHMPGlhZdj80Pkbw-FJmO44QK0wd4p7izWwzXh-ePF_TyM14bQa1Zp5AHLLBzt_yy6qRC3XxemGqrwBMjOP0PmYzaIzAy5g8vvsyndt3v3CFGdeJ6EawawosJ5AYck50DH5pdc3Yx4a45XDuTtcAGZ1c1gFFwy9XLEYortcY1VZr_6r9PGVO3C-CIKnrsUqNuFUFxpV0vYrWZIwFDMNTMSeQna2o3Tnk-hfU19CMJbkqClku4KFx1eWvSrrgNqlg3pDspZrI6ieb_WC0)

thanks,
David.