complicated conditional in Activity diagram

0 votes
asked Sep 27, 2017 in To be sorted by anonymous

I tried to use our plantuml to redraw below activity diagram.

 https://raw.githubusercontent.com/wiki/webmachine/webmachine/images/http-headers-status-v3.png

It has much complicated conditional. 

Don't know if we have a better solution for such conditional.

Any advise?


@startuml
!define R_ -[#red]->
!define G_ -[#green]->
!define B_ -[#blue]->
!definelong Res(x) 
#skyblue:x|
kill
!enddefinelong
 
skinparam activityBorderColor black
skinparam activityArrowColor green
'skinparam IfColor aqua
'scale 3138*2184
'scale 1366*768
 
start
B_
#aqua:if (Available?) then (false)
R_ 
Res(503 Service Unavailable)
(true) elseif (Known Method?) then (false)
R_
Res(501 Not Implemented)
(true) elseif (URI not too long?) then (false)
R_
Res(414 Request URI Too Long)
(true) elseif (Is method allowed on this resource?) then (false)
R_
Res(405 Method Not Allowed)
(true) elseif (Not Malformed?) then (false)
R_
Res(400 Bad Request)
(true) elseif (Authorized?) then (false)
R_
Res(401 Unauthorized)
(true) elseif (Not Forbidden?) then (false)
R_
Res(403 Forbidden)
(true) elseif (Known and Supported Content-* header) then (false)
R_
Res(501 Unimplemented)
(true) elseif (Known Content-Type) then (false)
R_
Res(405 Unsupported Media Type)
(true) elseif (Request entity NOT too large?) then (false)
R_
Res(413 request Entity Too Large)
(true) elseif (OPTIONS?) then (true)
G_
Res(200 OK)
else (false)
R_
endif
R_
if (Accept exists?) then (true)
G_
if (Acceptable media type available?) then (true)
G_
else (false)
R_
Res(406 Not Acceptable)
endif
else (false)
R_
endif
 
if (Accept-Language exists?) then (true)
G_
if (Acceptable language available?) then (true)
G_
else (false)
R_
Res(406 Not Acceptable)
endif
else (false)
R_
endif
 
if (Accept Charset exists?) then (true)
G_ 
if (Acceptable charset available?) then (true)
G_
else (false)
R_
Res(406 Not Acceptable)
endif
else (false)
endif
 
if (Accept Encoding exists?) then (true)
G_
if (Acceptable encoding available?) then (true) 
G_
else (false)
R_
Res(406 Not Acceptable)
endif
else (false)
R_
endif
 
if (Resource exists?) then (true)
' Resource exists
G_
if (If-Match exists?) then (true)
G_
if (If-Match:* exists?) then (true)
G_
else (false)
R_
if (Etag in If-Match) then (true)
G_
else (false)
R_
Res(412 Precondition Failed)
endif
endif
else (false)
R_
endif
 
if (if-Unmodified-Since exists) then (true)
G_
if (If-Unmodified-Since is valid date?) then (true)
G_ 
if (Last-Modified > if-Unmodified-Since?) then (true)
G_
Res(412 Precondition Failed)
else (false)
R_
endif
else (false)
R_
endif
else (false)
R_
endif
 
if (if-None-Match exists?) then (true)
G_
if (if-None-Match:* exists) then (true)
G_
else(false)
R_
if (Etag in if-None-Match) then (true)
G_
if (GET/HEAD ?) then (true)
G_
Res(304 Not Modified)
else (false)
R_
Res(412 Precondition Failed)
endif
else (false)
R_
endif
endif
 
else (false)
R_
endif
 
if (If-Modified-Since exists?) then (false)
R_
(true) elseif (If-Modified-Since is valid date?) then (false)
R_
(true) elseif (If-Modified-Since <= Now?) then (false)
R_
(true) elseif (Last-Modified <= If-Modified-Since?) then (false)
R_
Res(304 Not Modified)
else (true)
endif
 
if (DELETE?) then (true)
else (false)
endif
 
 
else (false)
R_
'Resource doesn't exist
endif
 
stop
@enduml

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...