47
55

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

便利すぎるPlantUML - シーケンス図 | アクティビティ図 よく使うパターン備忘録

Last updated at Posted at 2018-03-19

PlantUML - シーケンス図 | アクティビティ図テンプレート

このテンプレートがあれば、やりたいことはひとまず書ける!

用意するもの


  1. 既にPlantUMLが動く環境
    2. java(JAVA (JDK or JRE)
    3. Graphviz
    4. IDEがAtomなら下記パッケージをインストール
    5. plantuml-viewer
    6. language-plantuml

ソースコード


Editorに貼り付けて動作確認してみてください
また、サンプルなので処理内容に全く意味はないです

シーケンス図 サンプル

sequence_sample.pu
@startuml
header Page Header
footer Page Footer
actor act1
participant Front
control Middle
database Back
collections CSV
box "Batch Service" #LightBlue
	participant Back
	participant CSV
end box
act1 -> Front
Front -> Middle
Middle -> Back
Back -> Middle
Middle -> Front
note right of Middle #FF0000
 Business logic.
end note
Front -> act1
act1 -> act1: I did only the operation for myself.\nFor example, input.
note left of act1
  Various line shapes.
end note
act1 ->x Front
act1 -> Front
act1 ->> Front
act1 -\ Front
act1 \\- Front
act1 //-- Front
act1 ->o Front
act1 o\\-- Front
act1 <-> Front
act1 <->o Front
note over act1
  numbering.
end note
autonumber
act1 -[#FF0000]> Front
act1 -[#FF0000]-> Front
autonumber stop
autonumber 100
Front -[#0000FF]> Middle
Front -[#0000FF]-> Middle
autonumber stop
== Regular execution ==
hnote over Back: idle
Back --> CSV
ref over Back
  This CSV format.
end ref
... 2 minutes latter ...
CSV --> Back
== Logic ==
Middle -> Back: Request.
alt successful case
	Back -> Middle: Accepted.
else some kind of failure
	Back -> Middle: Failure.
	group My own label
		Middle -> Log : Log start
	    loop 1000 times
	        Middle -> Back: Go Back.
	    end
		Middle -> Log : Log end.
	end
else Another type of failure
   Back -> Middle: repeat.
end
@enduml

上記から生成された.png


sample.png

アクティビティ図 サンプル

activity_sample.pu

@startuml
start
:Initialize;
if (case1) then (yes)
  :process1;
  note left
    Success case:-)
  end note
  :Output messages.;
  fork
    :TypeA or B dedicated process;
    if (TypeA) then (yes)
      :TypeA dedicated process;
    else (no)
      :TypeB dedicated process;
      repeat
        :read data;
        :Send e-mail;
      repeat while (more data?)
    endif
  fork again
    :TypeC dedicated process;
    :Send e-mail;
  endfork
elseif (case2) then (yes)
  :process2;
  note left
    Warning case:-|
  end note
  if (process3) then (yes)
    :Output message.;
  else (no)
    :abort...;
    stop
  endif
else (no)
  :get error messages.;
  note right
    Faild case:-(
    ====
    Bye!
  end note
  while (for each error messeges.)
    :Send e-mail;
  endwhile
endif
:Finalize;
end
@enduml

上記から生成された.png


sample.png

感想


かなり作業が捗る

47
55
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
47
55

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?