How to add Exception Line and group items in PlantUML Activity Diagram?

+2 votes
asked Feb 15, 2019 in Question / help by ibey7804 (260 points)

Is there a way to add an Exception line (lightnining bolt style) to a PlantUML Activity Diagram? Something like this:

It would also be useful to have a way to group a set of Activity nodes inside a dotted-line rectangle. I believe these are standard UML symbols for Activity Diagrams.

1 Answer

0 votes
answered Feb 18, 2019 by zimchaa (1,040 points)
selected Mar 1, 2019 by ibey7804
 
Best answer

Having a look here: https://www.uml-diagrams.org/activity-diagrams.html, an alternative option from the spec is a straight line with a 'zig-zag' glyph, this might be more achievable, given everything working with straight lines - I tried adding a rectangle, with dashed lines and rounded corners (this could be set via the skinparams, as in other diagrams) for a specific <<interruptable>> stereotype, but this doesn't work in the Activity diagram types.

This diagram is close, but I'd say - the wrong way to do it using bits and pieces from the component toolbox - a couple of things that would be reusable in a proper diagram is the sprite and the process names.

@startuml
hide stereotype
''skinparam linetype ortho
skinparam rectangle {
    roundCorner<<interruptable>> 25
    roundCorner<<start>> 25
    roundCorner<<process>> 10
    
    backgroundColor<<start>> black
}
skinparam shadowing false

sprite $interruptzigzag [16x16/16] {
0000000000000000
0000000000000000
0000000000000000
0000000000000000
000FFFFFFFFFFF00
000000000000F000
00000000000F0000
0000000000F00000
000000000F000F00
00000000F00000F0
0000000FFFFFFFFF
00000000000000F0
0000000000000F00
0000000000000000
0000000000000000
0000000000000000
}

frame "ad Interruptable Activity Region" {

rectangle " " <<interruptable>> #line.dashed {
        rectangle "Process Order" as process <<process>>
        rectangle "Cancel Request" as cancelreq
}

rectangle "Close Order" as close <<process>>

rectangle "Cancel Order" as cancel <<process>>

process -right-> close

start -down-> process

close -> end

cancel --> end

cancelreq -> cancel: <$interruptzigzag>

'' layout

cancelreq -[hidden]down-> process

}

@enduml

http://liveuml.com/diagram/view/5c6a92213fa83d1ca990c737

It would be nice if we could have frames for every type of diagram, and perhaps a group-able, customisable rectangle as well.

ad Interruptable Activity Region

commented Feb 18, 2019 by zimchaa (1,040 points)
Here's a look at what it would be with a standard 'Activity Beta' syntax, which I like better overall:

@startuml
skinparam shadowing false

sprite $interruptzigzag [16x16/16] {
0000000000000000
0000000000000000
0000000000000000
0000000000000000
000FFFFFFFFFFF00
000000000000F000
00000000000F0000
0000000000F00000
000000000F000F00
00000000F00000F0
0000000FFFFFFFFF
00000000000000F0
0000000000000F00
0000000000000000
0000000000000000
0000000000000000
}

start

partition "Interruptable Region" {
   
  split

      :process order;

  split again
  
      :Cancel Request<
 
    -> <$interruptzigzag>;

    (A)

      detach
   
  end split

}

:close order;

stop

(A)

:cancel order;

stop

@enduml
commented Feb 18, 2019 by ibey7804 (260 points)
Thanks for your help.
...