Plantuml Loop Activity Diagram

broken image


A UML Sequence diagram shows how messages go back and forth between objects over time. It is an interaction diagram.

The basic syntax for a line in a sequence diagram shows that one participant is sending a message to another participant:

Old syntax for activity diagram had several limitations and drawbacks (for example, it's difficult to maintain). So a completely new syntax and implementation is now available to users. Another advantage of this implementation is that it's done without the need of having Graphviz installed (as for sequence diagrams). This activity diagram shows the process of logging into a website, from entering a username and password to successfully logging in to the system. It uses different container shapes for activities, decisions, and notes. Lucidchart is the ideal tool for creating any kind of UML flowchart, whether it's an activity diagram, a use case diagram. This site has different variety of PlantUML examples with rendered images. User User System System add an object loop !validation informations demand name, corresponding class loop add a value loop. ACTIVITY DIAGRAM. User User A A B B DoWork Internal call. This is the old Activity Diagram (legacy) syntax, to see the new current version see: Activity Diagram (new). You can use (.) for the starting point and ending point of the activity diagram. In some occasion, you may want to use (.top) to force the starting point to be at the top of the diagram. Use - for arrows. 当前活动图(activity diagram)的语法有诸多限制和缺点,比如代码难以维护。 所以从V7947开始提出一种全新的、更好的语法格式和软件实现供用户使用(beta版)。 就像序列图一样,新的软件实现的另一个优点是它不再依赖于Graphviz。 新的语法将会替换旧的语法。.

More formally: 1>arrow>2>:

Sequence diagram showing interaction between Alice and Bob:

Here is the source for the diagram:

Keywords¶

Be sure to also read about the keywords and options that can be applied to all diagrams:Global keywords and options

Participants¶

Todo

words about what participants are in general. types…

Usage:

participant'label>'

[asalias>]

[#name|hexcode>]

[<<[(,)][stereotypename]>>]

[order]

Participants are the message senders. Use the participant keyword to give a name to a message sender and optionally give it an alias and format it.

If the displayed label for a participant has spaces or special characters, put quotes around it. (Ex: 'RequestHandler')

You don't have to use the participant keyword because PlantUML will automatically display a sender whenever it encounters one in the source.But using the keyword gives you the ability to set the following options:

You can use a participant line anywhere in your source (at any time).This is one way you can control the order of the participant boxes across the top.

Options:
as :

provide an alias for the participant. This is useful if the displayed name is long; you can just use the shorter alias in the rest of the source.

color #:

set the color of the image displayed. Use a color name or hex code.

Ex: participantAlice#lightGreen

<< [(, )] [] >>:

(stereotype box) …

Ex: participant'RequestHandler'<<(S,#lightBlue)server>>

order :

set the specific order for the participant. Otherwise PlantUML just orders the participants as it encounters them.

order must come last else you'll get a syntax error!

Ex: participant'RequestHandler'order3

Example:

You can show a message coming from or going to a participant not in the scope of the current diagram by using ] or [

  • ] shows a message going to outside the scope of the diagram (to a participant not in the diagram)
  • [ shows a message coming from outside the scope of the diagram (from a participant not in the diagram)
Skinparams:

Participant

ParticipantBorderThickness

actor

actor is a stereotype (synonym) for participant that displays a person stick figure instead of the standard box. All of the same options as participant can be used.

Skinparams:

ActorBorderThickness

Actor { } – note that the last Actor skinparams read will be the ones that are applied!

boundary

boundary is a stereotype (synonym) for participant that displays a boundary image instead of the standard box. All of the same options as participant can be used.

entity

entity is a stereotype (synonym) for participant that displays an entity image instead of the standard box. All of the same options as participant can be used.

control

control is a stereotype (synonym) for participant that displays a control image instead of the standard box. All of the same options as participant can be used.

database

database is asynonym for participant that displays a database image instead of the standard box. All of the same options as participant can be used.

create

create puts the first occurrence of the diagram for the participant within the diagram where this word appears instead of at the top of the page.Helps to show that an object is actually created at that point in time.

Usage:create order
  • cannot use 'as'

    In the example above, create'AuthSystem' is used to show exactly when the wrappedRequest is created

Arrows (Graphic Paths)¶

Arrows are used to show messages sent to and from participant along a graphic path.

Skinparams:

Special note about arrows and skin params: the last one is the one used. ( an include and reference to ..?)

ArrowThickness

Ex: skinparamSequenceArrowThickness4

Ex: skinparamSequence{ArrowThickness4}

MessageAlignment

MessageTextAlignment

Arrow Heads¶

Solid arrow heads represent synchronous messages. Open (not filled in) arrow heads represent asynchronous messages. (See the UML 2.5 Specification, section 17.4.4.1 Message Notation)

>> creates an unfilled arrow pointing to the right (This is an asynchronous message.)

<< creates an unfilled arrow pointing to the left (This is an asynchronous message.)

> creates a filled (solid) arrow head pointing to the right (This is a synchronous message.)

< creates a filled (solid) arrow head pointing to the left (This is a synchronous message.)

creates the top half (only) of an unfilled arrow pointing to the right

// creates the bottom half (only) of an unfilled arrow pointing to the right

creates the top half (only) of a filled arrow pointing to the right

/ creates the bottom half (only) of a filled arrow pointing to the right

? means the arrow line is short; it is only as long as the label for it.

If the ? is at the end, the arrow line is connected to the start (origin) and stops when the label for it stops.

If the ? is at the end, then the arrow is connected to the end (target), and the arrow line is only as long as the arrow label.

o puts a final 'o' at arrow head, denoting a lost message

x puts an *X* at the end, denoting a destruction message.

You can create a bidirectional arrow by putting arrow heads at both ends of a line. Ex: <->

Arrow Lines¶

Solid lines show messages sent. Dashed lines represent reply messages.

An object creation Message has a dashed line with an open arrow head.

- creates a solid line

-- (two dashes instead of just one) creates dotted line

Note

If you use dots ... for an arrow line, PlantUML will think you are working with a Use Case diagram instead of a Sequence diagramand will change how it draws (renders) it.

You can make dashedarrow lines as long as you want, but they will be drawn only as long as needed andcalculated by Graphviz.

Plantuml Activity Diagram Loop

Ex: You can do this:

And it will be rendered/drawn like this:

Arrow Color¶

You can change the color of an arrow by putting the color within square brackets just before the ending arrow-head characters:

Ex: -[#magenta]>> will create a magenta colored unfilled arrow with a solid line

Ex: --[#939393]> will create a gray colored filled arrow with a dashed line

Autonumber Graphic Paths¶

Usage:

autonumber[start|resume][increment][format]

  • automatically number each arrow in the sequence
  • can format the numbering: '(##)'
    • must be in double quotes
    • accepts simple printf type formatting (## 0 etc)
Plantuml

Todo

autonumber

resume
autonumber stop

Lifelines (ExecutionSpecification)¶

The activate and deactivate keywords are used to denote participant activation and deactivation on its lifeline.The UML 2.5 specification refers to this as an ExecutionSpecification: exactly what messages are called, and in what order, are specified in this particular section of the diagram.

You can also explictly destroy the lifeline of a participant, showing exactly when something is destroyed.

Skinparams:

LifeLineBackgroundColor

LifeLineBorderColor

LifeLineBorderThickness

Usage:activate[color]
deactivate
Usage:deactivate
Usage:destroy

Frames Around Fragments¶

Frames are rectangular boxes around a fragment (or sub-clause) of a sequence. It is a box around certain participants and messages.There is a name in the upper-left corner of the frame and, in the case of a group box, optionally a label across the top of the frame.

  • All frame keywords must have a correspondingend to signal where the frame ends
  • You can nest frames
  • You cannot use a note within a frame
  • See section 17.6 in the UML 2.5 Specification
  • PlantUML does not implement all InteractionOperator kinds, but you can use the group box to put in the name of any InteractionOperator you want.
Skinparam:

Even though these skinparams start with Group they apply to all frames.

  • The GroupHeaderFont formats the text that appears in the pentagon in the upper-left-hand corner of the frame. Here are the specific skinparam options:

    GroupHeaderFontColor

    GroupHeaderFontName

    GroupHeaderFontSize

    GroupHeaderFontStyle

  • GroupBodyBackgroundColor formats that background color of the frame. Here are the specific skinparam options:

    GroupBorder formats the border of the frame.

    GroupBorderColor

    GroupBorderThickness

  • GroupFont formats the text at the top of the frame. Here are the specific skinparam options:

    GroupFontColor

    GroupFontName

    GroupFontSize

    GroupFontStyle

Usage:

alt''

<...whatevergoeswithinthebox...>

end

InteractionOperator alt is used to show one or more alternative sequences that can happen. A dashed lineis used between the possible alternative sequences.

alt is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

else
Usage:

else''

<...whatevergoeswithinthebox...>

end

In the UML specification, else is the default sequence in a list of alternative sequences.The else InteractionOperator is used to show the sequence that will be used if the none of conditions forthe alt alternatives can be met. else is the frame name in the pentagon in the upper left hand corner.

But in PlantUML_ this is how you label different alternatives. You can use the groupkeyword to specifically display the word 'else' and use it per the UML Specification.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels this alternative.

Example:
opt
Usage:

opt''

<...whatevergoeswithinthebox...>

end

An optional sequence. It either happens or not.

opt is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

Usage:

loop''

<...whatevergoeswithinthebox...>

end

Shows a sequence that loops.

loop is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

par
Usage:

par''

<...whatevergoeswithinthebox...>

end

Shows a parallel sequence.

par is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

Usage:

break

<...whatevergoeswithinthebox...>

end

shows that a sequence breaks. It stops (does not perform) any of the remaining sequence does this instead.

break is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

critical
Usage:

critical''

<...whatevergoeswithinthebox...>

end

A fragment of a sequence that cannot be 'interleaved' by other fragments (e.g. parallel fragments, etc.).

critical is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

Usage:

group'name>'

<...whatevergoeswithinthebox...>

end

allows you to fully specify the frame name.

frame name is the frame name in the pentagon in the upper left hand corner.

Note that you cannot add text after the frame name.

Class

Todo

autonumber

resume
autonumber stop

Lifelines (ExecutionSpecification)¶

The activate and deactivate keywords are used to denote participant activation and deactivation on its lifeline.The UML 2.5 specification refers to this as an ExecutionSpecification: exactly what messages are called, and in what order, are specified in this particular section of the diagram.

You can also explictly destroy the lifeline of a participant, showing exactly when something is destroyed.

Skinparams:

LifeLineBackgroundColor

LifeLineBorderColor

LifeLineBorderThickness

Usage:activate[color]
deactivate
Usage:deactivate
Usage:destroy

Frames Around Fragments¶

Frames are rectangular boxes around a fragment (or sub-clause) of a sequence. It is a box around certain participants and messages.There is a name in the upper-left corner of the frame and, in the case of a group box, optionally a label across the top of the frame.

  • All frame keywords must have a correspondingend to signal where the frame ends
  • You can nest frames
  • You cannot use a note within a frame
  • See section 17.6 in the UML 2.5 Specification
  • PlantUML does not implement all InteractionOperator kinds, but you can use the group box to put in the name of any InteractionOperator you want.
Skinparam:

Even though these skinparams start with Group they apply to all frames.

  • The GroupHeaderFont formats the text that appears in the pentagon in the upper-left-hand corner of the frame. Here are the specific skinparam options:

    GroupHeaderFontColor

    GroupHeaderFontName

    GroupHeaderFontSize

    GroupHeaderFontStyle

  • GroupBodyBackgroundColor formats that background color of the frame. Here are the specific skinparam options:

    GroupBorder formats the border of the frame.

    GroupBorderColor

    GroupBorderThickness

  • GroupFont formats the text at the top of the frame. Here are the specific skinparam options:

    GroupFontColor

    GroupFontName

    GroupFontSize

    GroupFontStyle

Usage:

alt''

<...whatevergoeswithinthebox...>

end

InteractionOperator alt is used to show one or more alternative sequences that can happen. A dashed lineis used between the possible alternative sequences.

alt is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

else
Usage:

else''

<...whatevergoeswithinthebox...>

end

In the UML specification, else is the default sequence in a list of alternative sequences.The else InteractionOperator is used to show the sequence that will be used if the none of conditions forthe alt alternatives can be met. else is the frame name in the pentagon in the upper left hand corner.

But in PlantUML_ this is how you label different alternatives. You can use the groupkeyword to specifically display the word 'else' and use it per the UML Specification.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels this alternative.

Example:
opt
Usage:

opt''

<...whatevergoeswithinthebox...>

end

An optional sequence. It either happens or not.

opt is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

Usage:

loop''

<...whatevergoeswithinthebox...>

end

Shows a sequence that loops.

loop is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

par
Usage:

par''

<...whatevergoeswithinthebox...>

end

Shows a parallel sequence.

par is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

Usage:

break

<...whatevergoeswithinthebox...>

end

shows that a sequence breaks. It stops (does not perform) any of the remaining sequence does this instead.

break is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

critical
Usage:

critical''

<...whatevergoeswithinthebox...>

end

A fragment of a sequence that cannot be 'interleaved' by other fragments (e.g. parallel fragments, etc.).

critical is the frame name in the pentagon in the upper left hand corner.

text is displayed in square brackets ([]) at the top of the frame; it describes or labels frame as a whole.

Usage:

group'name>'

<...whatevergoeswithinthebox...>

end

allows you to fully specify the frame name.

frame name is the frame name in the pentagon in the upper left hand corner.

Note that you cannot add text after the frame name.

Reference Frame (InteractionUse)¶

Usage:

ref'name>'

A reference to some other interaction or diagram.ref is the frame name in the pentagon in the upper left hand corner.

Skinparam:ReferenceAlignmentReferenceBackgroundColorReferenceBorderColorReferenceBorderThicknessReferenceFontColorReferenceFontNameReferenceFontSizeReferenceFontStyleReferenceHeaderBackgroundColor

Todo

example for reference frame

Usage:

...[...]

Indicates a delay in the diagram. You can optionally add text to describe the delay.

Skinparam:DelayFontColorDelayFontNameDelayFontSizeDelayFontStyle

Todo

Example for delay

Plantuml Loop Activity Diagram Pdf

Spacing¶

  • ||| or || ||

Dividers¶

Skinparam:DividerBackgroundColorDividerBorderColorDividerBorderThicknessDividerFontColorDividerFontNameDividerFontSizeDividerFontStyle

Class Diagram

Notes¶

Notes for Participants¶

  • for participants:
    • put this under section about participants?

Notes for Arrows¶

  • for arrows (graphic paths) (messages)
    • put this info under the section about graphic paths?

Todo

Plantuml Flow Chart

newpage - is this common? or only on sequence diagrams?

Plantuml Sequence Diagram

A longer sequence of events with some skinparam styles used:

Skinparams specific to Sequence Diagrams¶





broken image