zoukankan      html  css  js  c++  java
  • PlantUML的实例参考

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

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

    
    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
    
    

    
    actor Bob #red
    ' The only difference between actor
    'and participant is the drawing
    participant Alice
    participant "I have a really
    long name" as L #99FF99
    /' You can also declare:
       participant L as "I have a really
    long name"  #99FF99
      '/
    
    Alice->Bob: Authentication Request
    Bob->Alice: Authentication Response
    Bob->L: Log transaction
    
    

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

    
    Alice->Alice: This is a signal to self.
    It also demonstrates
    multiline 
    text
    
    

    
    Bob ->x Alice
    Bob -> Alice
    Bob ->> Alice
    Bob - Alice
    Bob \- Alice
    Bob //-- Alice
    
    Bob ->o Alice
    Bob o\-- Alice
    
    Bob <-> Alice
    Bob <->o Alice
    
    

    
    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
    
    

    
    title Simple communication example
    
    Alice -> Bob: Authentication Request
    Bob --> Alice: Authentication Response
    
    Alice -> Bob : Hello
    legend right
      Short
      legend
    endlegend
    
    

    
    
    Alice -> Bob : message 1
    Alice -> Bob : message 2
    
    newpage
    
    Alice -> Bob : message 3
    Alice -> Bob : message 4
    
    newpage A title for the
    last page
    
    Alice -> Bob : message 5
    Alice -> Bob : message 6
    
    

    
    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
    
    

    
    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
    
    

    
    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
     over Bob and Alice.
    
    note over Bob, Alice
        This is yet another
        example of
        a long note.
    end note
    

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

    
    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 
    
    

    
    
    == Initialization ==
    
    Alice -> Bob: Authentication Request
    Bob --> Alice: Authentication Response
    
    == Repetition ==
    
    Alice -> Bob: Another authentication Request
    Alice <-- Bob: another authentication Response
    
    

    
    participant Alice
    actor Bob
    
    ref over Alice, Bob : init
    
    Alice -> Bob : hello
    
    ref over Bob
      This can be on
      several lines
    end ref
    

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

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

    
    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
    
    

    
    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
    
    

    
    Bob -> Alice : hello
    
    create Other
    Alice -> Other : new
    
    create control String
    Alice -> String
    note right : You can also put notes!
    
    Alice --> Bob : ok
    
    

    
    [-> A: DoWork
    
    activate A
    
    A -> A: Internal call
    activate A
    
    A ->] : << createRequest >>
    
    A<--] : RequestCreated
    deactivate A
    [<- A: Done
    deactivate A
    
    

    
    [-> Bob
    [o-> Bob
    [o->o Bob
    [x-> Bob
    
    [<- Bob
    [x<- Bob
    
    Bob ->]
    Bob ->o]
    Bob o->o]
    Bob ->x]
    
    Bob <-]
    Bob x<-]
    

    @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
    
    

  • 相关阅读:
    C语言学习趣事_19_C参考手册连接
    2_Windows下利用批处理文件获取命令行命令帮助信息
    C语言学习趣事_FILE_TYPE
    清华大学出版社版_Windows程序设计_方敏_不足_3
    Windows程序设计零基础自学_14_Windows文件和目录操作
    3_Windows下利用批处理文件_去除C源代码中指示行号的前导数字
    随想_7_Windows_7_Visual_Studio_2008_问题
    C语言小算法_1_数值转换
    C语言学习趣事_20_Assert_Setjmp
    C语言学习趣事_20_关于数组名与指针的讨论
  • 原文地址:https://www.cnblogs.com/pcy0/p/plant-uml-instances.html
Copyright © 2011-2022 走看看