PlantUML的实例参考

project: blog
target: plant-uml-instances.md
date: 2015-12-24
status: publish
tags:
    - PlantUML
    - UML
categories:
    - UML

PlantUML的实例参考_第1张图片


Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response

PlantUML的实例参考_第2张图片


actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity
Foo1 -> Foo5 : To database

PlantUML的实例参考_第3张图片


actor Bob #red
' The only difference between actor
'and participant is the drawing
participant Alice
participant "I have a really\nlong name" as L #99FF99
/' You can also declare:
   participant L as "I have a really\nlong name"  #99FF99
  '/

Alice->Bob: Authentication Request
Bob->Alice: Authentication Response
Bob->L: Log transaction

PlantUML的实例参考_第4张图片


Alice -> "Bob()" : Hello
"Bob()" -> "This is very\nlong" as Long
' You can also declare:
' "Bob()" -> Long as "This is very\nlong"
Long --> "Bob()" : ok

PlantUML的实例参考_第5张图片


Alice->Alice: This is a signal to self.\nIt also demonstrates\nmultiline \ntext

PlantUML的实例参考_第6张图片


Bob ->x Alice
Bob -> Alice
Bob ->> Alice
Bob -\ Alice
Bob \\- Alice
Bob //-- Alice

Bob ->o Alice
Bob o\\-- Alice

Bob <-> Alice
Bob <->o Alice

PlantUML的实例参考_第7张图片


Bob -[#red]> Alice : hello
Alice -[#0000FF]->Bob : ok

autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response


autonumber 15
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response

autonumber 40 10
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response


autonumber "<b>[000]"
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response

autonumber 15 "<b>(<u>##</u>)"
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response

autonumber 40 10 "<font color=red><b>Message 0  "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response

PlantUML的实例参考_第8张图片


title Simple communication example

Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob : Hello
legend right
  Short
  legend
endlegend

PlantUML的实例参考_第9张图片



Alice -> Bob : message 1
Alice -> Bob : message 2

newpage

Alice -> Bob : message 3
Alice -> Bob : message 4

newpage A title for the\nlast page

Alice -> Bob : message 5
Alice -> Bob : message 6

PlantUML的实例参考_第10张图片


Alice -> Bob: Authentication Request

alt successful case

    Bob -> Alice: Authentication Accepted
    
else some kind of failure

    Bob -> Alice: Authentication Failure
    group My own label
        Alice -> Log : Log attack start
        loop 1000 times
            Alice -> Bob: DNS Attack
        end
        Alice -> Log : Log attack end
    end
    
else Another type of failure

   Bob -> Alice: Please repeat
   
end

PlantUML的实例参考_第11张图片


Alice->Bob : hello
note left: this is a first note

Bob->Alice : ok
note right: this is another note

Bob->Bob : I am thinking
note left
    a note
    can also be defined
    on several lines
end note

PlantUML的实例参考_第12张图片


participant Alice
participant Bob
note left of Alice #aqua
    This is displayed 
    left of Alice. 
end note
 
note right of Alice: This is displayed right of Alice.

note over Alice: This is displayed over Alice.

note over Alice, Bob #FFAAAA: This is displayed\n over Bob and Alice.

note over Bob, Alice
    This is yet another
    example of
    a long note.
end note

PlantUML的实例参考_第13张图片

caller -> server : conReq
hnote over caller : idle
caller <- server : conConf
rnote over server
 "r" as rectangle
 "h" as hexagon
endrnote

PlantUML的实例参考_第14张图片


participant Alice
participant "The **Famous** Bob" as Bob

Alice -> Bob : hello --there--
... Some ~~long delay~~ ...
Bob -> Alice : ok
note left
  This is **bold**
  This is //italics//
  This is ""monospaced""
  This is --stroked--
  This is __underlined__
  This is ~~waved~~
end note

Alice -> Bob : A //well formatted// message
note right of Alice 
 This is <back:cadetblue><size:18>displayed</size></back> 
 __left of__ Alice. 
end note
note left of Bob 
 <u:red>This</u> is <color #118888>displayed</color> 
 **<color purple>left of</color> <s:red>Alice</strike> Bob**. 
end note
note over Alice, Bob
 <w:#FF33FF>This is hosted</w> by <img sourceforge.jpg>
end note 

PlantUML的实例参考_第15张图片



== Initialization ==

Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

== Repetition ==

Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response

PlantUML的实例参考_第16张图片


participant Alice
actor Bob

ref over Alice, Bob : init

Alice -> Bob : hello

ref over Bob
  This can be on
  several lines
end ref

PlantUML的实例参考_第17张图片


Alice -> Bob: Authentication Request
...
Bob --> Alice: Authentication Response
...5 minutes latter...
Bob --> Alice: Bye !

PlantUML的实例参考_第18张图片


Alice -> Bob: message 1
Bob --> Alice: ok
|||
Alice -> Bob: message 2
Bob --> Alice: ok
||45||
Alice -> Bob: message 3
Bob --> Alice: ok

PlantUML的实例参考_第19张图片


participant User

User -> A: DoWork
activate A

A -> B: << createRequest >>
activate B

B -> C: DoWork
activate C
C --> B: WorkDone
destroy C

B --> A: RequestCreated
deactivate B

A -> User: Done
deactivate A

PlantUML的实例参考_第20张图片


participant User

User -> A: DoWork
activate A #FFBBBB

A -> A: Internal call
activate A #DarkSalmon

A -> B: << createRequest >>
activate B

B --> A: RequestCreated
deactivate B
deactivate A
A -> User: Done
deactivate A

PlantUML的实例参考_第21张图片


Bob -> Alice : hello

create Other
Alice -> Other : new

create control String
Alice -> String
note right : You can also put notes!

Alice --> Bob : ok

PlantUML的实例参考_第22张图片


[-> A: DoWork

activate A

A -> A: Internal call
activate A

A ->] : << createRequest >>

A<--] : RequestCreated
deactivate A
[<- A: Done
deactivate A

PlantUML的实例参考_第23张图片


[-> Bob
[o-> Bob
[o->o Bob
[x-> Bob

[<- Bob
[x<- Bob

Bob ->]
Bob ->o]
Bob o->o]
Bob ->x]

Bob <-]
Bob x<-]

PlantUML的实例参考_第24张图片

@startuml

/'
This is an example Sequence diagram
Showing a fictional web feature flow
It is easy to see roles & responsibilities for each component
and easy to change them too...
'/

title "Story Feature Example - Sequence Diagram"

'This is a single line comment

/'
This is a multi-line comment
One another line
'/

actor User
'boundary Proxy
participant UIServer as UI
participant API

User -> UI: LINK: goto /account page
activate UI
UI -> User:
deactivate UI

activate User
note over User
  Requirments:
  UI: Setting Page
  Click delete button
end note

' user requests account/delete page
User -> UI: /account/delete
deactivate User
activate UI
UI -> User:
deactivate UI

' confirmation form
activate User
note over User
  UI: Form
  Are you sure?
end note


User -> UI: POST /account/delete
deactivate User
activate UI

note over UI: Verify: user has confirmed
UI -> API: /account/delete
activate API
API -> API: delete
API -> UI: done
deactivate API
UI -> User: success
deactivate UI

@enduml

你可能感兴趣的:(PlantUML的实例参考)