Current syntax_for_activity_diagram has several limitations and drawbacks (for example, it's difficult to maintain). So a completely new syntax and implementation is proposed as beta version to users (starting with V7947), so that we could define a better format and syntax. Another advantage of this new implementation is that it's done without the need of having Graphviz installed (as for sequence diagrams). The new syntax will replace the old one. However, for compatibility reason, the old syntax will still be recognized, to ensure ascending compatibility. Users are simply encouraged to migrate to the new syntax.
Activities label starts with : and ends with ;. Text formatting can be done using creole_wiki_syntax. They are implicitly linked in their definition order. <uml t=“activity2”> :Hello world; :This is on defined on several lines; </uml>
You can use start and stop keywords to denote the beginning and the end of a diagram. <uml t=“activity2_001”> start :Hello world; :This is on defined on several lines; stop </uml>
You can use if, then and else keywords to put tests if your diagram. Labels can be provided using parentheses. <uml t=“activity2_002”>
start
if (Graphviz installed?) then (yes)
:process all\ndiagrams;
else (no)
:process only __sequence__ and __activity__ diagrams;
endif
stop
</uml> You can use the elseif keyword to have several tests : <uml t=“activity2_003”> start if (condition A) then (yes)
:Text 1;
elseif (condition B) then (yes)
:Text 2; stop
elseif (condition C) then (yes)
:Text 3;
elseif (condition D) then (yes)
:Text 4;
else (nothing)
:Text else;
endif stop </uml>
You can use repeat and repeatwhile keywords to have repeat loops. <uml t=“activity2_004”>
start
repeat
:read data; :generate diagrams;
repeat while (more data?)
stop
</uml>
You can use while and end while keywords to have repeat loops. <uml t=“activity2_005”>
start
while (data available?)
:read data; :generate diagrams;
endwhile
stop
</uml> It is possible to provide a label after the endwhile keyword, or using the is keyword. <uml t=“activity2_006”> while (check filesize ?) is (not empty)
:read file;
endwhile (empty) :close file; </uml>
You can use fork, fork again and end fork keywords to denote parallel processing. <uml t=“activity2_007”>
start
if (multiprocessor?) then (yes)
fork :Treatment 1; fork again :Treatment 2; end fork
else (monoproc)
:Treatment 1; :Treatment 2;
endif
</uml>
Text formatting can be done using creole_wiki_syntax. <uml t=“activity2_008”>
start :foo1; note left: This is a note :foo2; note right
This note is on several //lines// and can contain <b>HTML</b> ==== * Calling the method ""foo()"" is prohibited
end note stop
</uml>
You can add title, header, footer, legend to a diagram: <uml t=“activity2_009”> title this is my title if (condition?) then (yes)
:yes;
else (no)
:no; note right this is a note end note
endif stop
legend this is the legend endlegend
footer dummy footer header
this is a long __dummy__ header
end header
</uml>
You can use specify a color for some activities. <uml t=“activity2_010”>
start :starting progress; #HotPink:reading configuration files These files should edited at this point!; #AAAAAA:ending of the process;
</uml>
Using the → notation, you can add texts to arrow, and change their color. <uml t=“activity2_011”> :foo1; → You can put text on arrows; if (test) then
:foo2;
also be on several lines
and **very** long...; :foo3;
else
:foo4; endif -[#gray]→ :foo5; </uml>
You can group activity together by defining partition: <uml t=“activity2_012”> start partition Initialization {
:read config file; :init internal variable;
} partition Running {
:wait for user interaction; :print information;
}
stop </uml>
Using pipe |, you can define swimlanes. It's also possible to change swimlanes color. <uml t=“activity2_013”>
| Swimlane1 |
start :foo1;
| #AntiqueWhite | Swimlane2 |
:foo2; :foo3;
| Swimlane1 |
:foo4;
| Swimlane2 |
:foo5; stop </uml>
It's possible to remove an arrow using the detach keyword. <uml t=“activity2_014”> :start; fork
:foo1; :foo2;
fork again
:foo3; detach
endfork if (foo4) then
:foo5; detach
endif :foo6; detach :foo7; stop </uml>
By changing the final ; separator, you can set different rendering for the activity:
<uml t=“activity2_015”> :Ready; :next(o)| :Receiving; split :nak(i)< :ack(o)> split again :ack(i)< :next(o) on several line| :i := i + 1] :ack(o)> split again :err(i)< :nak(o)> split again :foo/ split again :i > 5} stop end split :finish; </uml>
<uml t=“activity2_016”>
start :ClickServlet.handleRequest(); :new page; if (Page.onSecurityCheck) then (true)
:Page.onInit();
if (isForward?) then (no)
:Process controls;
if (continue processing?) then (no)
stop
endif
if (isPost?) then (yes)
:Page.onPost();
else (no)
:Page.onGet();
endif
:Page.onRender();
endif
else (false) endif
if (do redirect?) then (yes)
:redirect process;
else
if (do forward?) then (yes) :Forward request; else (no) :Render page template; endif
endif
stop
</uml>