statemachine
Workflow for state
for field
State
{
 
initial
state
Submitted
{
on
send to backlog
[
always
]
do
{
<define statements>
}
transit to
Accepted
 
on
start hotfix
[
always
]
do
{
if
(
subtask of
.
isNotEmpty
)
{
//
feature subtasks are created directly in open state on feature dashboard and this workflow is executed
//
we just don't want to mark them as hotfixes
}
else
{
//
otherwise from submitted we can only open hotfixes
Type
=
{
Hotfix
}
;
if
(
Assignee
==
null
)
{
project
.
leader
.
notify
(
"
[ASSIGNEE]
"
+
getId
(
 
)
+
"
:
"
+
summary
,
getUrl
(
 
)
)
;
}
}
}
transit to
Open
 
on
can't reproduce
[
always
]
do
{
<define statements>
}
transit to
Can't Reproduce
 
on
won't fix
[
always
]
do
{
<define statements>
}
transit to
Won't fix
 
on
duplicate
[
always
]
do
{
<define statements>
}
transit to
Duplicate
}
 
state
Accepted
{
on
start hotfix
[
always
]
do
{
Type
=
{
Hotfix
}
;
if
(
Assignee
==
null
)
{
project
.
leader
.
notify
(
"
[ASSIGNEE]
"
+
getId
(
 
)
+
"
:
"
+
summary
,
getUrl
(
 
)
)
;
}
}
transit to
Open
 
on
send to development
[
always
]
do
{
if
(
Assignee
==
null
)
{
project
.
leader
.
notify
(
"
[ASSIGNEE]
"
+
getId
(
 
)
+
"
:
"
+
summary
,
getUrl
(
 
)
)
;
}
}
transit to
Open
 
on
can't reproduce
[
always
]
do
{
<define statements>
}
transit to
Can't Reproduce
 
on
won't fix
[
always
]
do
{
<define statements>
}
transit to
Won't fix
 
on
duplicate
[
always
]
do
{
<define statements>
}
transit to
Duplicate
}
 
state
Can't Reproduce
{
on
reopen
[
always
]
do
{
<define statements>
}
transit to
Submitted
}
 
state
Won't fix
{
on
reopen
[
always
]
do
{
<define statements>
}
transit to
Submitted
}
 
state
Duplicate
{
on
reopen
[
always
]
do
{
<define statements>
}
transit to
Submitted
}
 
state
Open
{
on
start work
[
always
]
do
{
assert
loggedInUser
==
Assignee
:
"
Only assignee can start work on this ticket.
"
;
if
(
Type
==
{
Hotfix
}
)
{
message
(
"
Don't forget to create ticket branch from master for this ticket.
"
)
;
}
else if
(
Branch
==
{
Ticket
}
)
{
message
(
"
Don't forget to create ticket branch from integration for this ticket.
"
)
;
}
}
transit to
In Progress
 
on
can't reproduce
[
always
]
do
{
<define statements>
}
transit to
Can't Reproduce
 
on
won't fix
[
always
]
do
{
<define statements>
}
transit to
Won't fix
 
on
duplicate
[
always
]
do
{
<define statements>
}
transit to
Duplicate
}
 
state
In Progress
{
on
send to code revision
[
always
]
do
{
if
(
Branch
!=
{
Parent
}
)
{
assert
loggedInUser
==
Assignee
:
"
Only assignee can finish work on this ticket.
"
;
assert
Tester
==
null
:
"
This ticket is already in testing stage and shouldn't be sent to code revision anymore. You should send it for test.
"
;
assert
Branch
==
{
Ticket
}
:
"
Only tickets in ticket branch can be send to code revision.
"
;
if
(
Code reviewer
==
null
)
{
project
.
leader
.
notify
(
"
[CODE REVIEWER]
"
+
getId
(
 
)
+
"
:
"
+
summary
,
getUrl
(
 
)
)
;
}
}
else
{
//
workflow within the feature is free
if
(
Code reviewer
==
null
)
{
subtask of
.
first
.
Assignee
.
notify
(
"
[CODE REVIEWER]
"
+
getId
(
 
)
+
"
:
"
+
summary
,
getUrl
(
 
)
)
;
}
}
}
transit to
Code revision
 
on
fix it
[
always
]
do
{
if
(
Branch
!=
{
Parent
}
)
{
assert
loggedInUser
==
Assignee
:
"
Only assignee can finish work on this ticket.
"
;
if
(
Type
!=
{
Hotfix
}
)
{
assert
Branch
!=
{
Ticket
}
:
"
Tickets in ticket branch are not prepared for testing yet. Please merge this ticket to integration branch
"
+
"
and change Branch field of this ticket.
"
;
if
(
Tester
==
null
)
{
project
.
leader
.
notify
(
"
[TESTER]
"
+
getId
(
 
)
+
"
:
"
+
summary
,
getUrl
(
 
)
)
;
}
}
else
{
Branch
=
{
Master
}
;
message
(
"
Done hotfixes are moved instantly to master to be released. Please merge ticket branch to master immediately!
"
)
;
}
//
workflow within the feature is free
}
}
transit to
Fixed
 
on
can't reproduce
[
always
]
do
{
<define statements>
}
transit to
Can't Reproduce
 
on
won't fix
[
always
]
do
{
<define statements>
}
transit to
Won't fix
 
on
duplicate
[
always
]
do
{
<define statements>
}
transit to
Duplicate
}
 
state
Code revision
{
on
reopen
[
always
]
do
{
if
(
Branch
!=
{
Parent
}
)
{
assert
loggedInUser
==
Code reviewer
:
"
Only code reviewer can reopen this ticket.
"
;
assert
Branch
==
{
Ticket
}
:
"
Only tickets in ticket branch can be sent back from code revision.
"
;
}
//
workflow within the feature is free
}
transit to
In Progress
 
on
send to integration
[
always
]
do
{
if
(
Branch
!=
{
Parent
}
)
{
assert
loggedInUser
==
Code reviewer
:
"
Only code reviewer can finish this ticket.
"
;
assert
Branch
==
{
Ticket
}
:
"
Only tickets in ticket branch can be sent to integration.
"
;
if
(
(
Type
!=
{
Hotfix
}
)
)
{
addComment
(
"
Code revision passed, please merge this ticket to integration branch and change branch to Integration.
"
)
;
}
else
{
addComment
(
"
Code revision passed, please merge this ticket to master branch and change branch to Master.
"
)
;
}
}
//
workflow within the feature is free
}
transit to
Fixed
}
 
state
Fixed
{
on
reopen
[
always
]
do
{
if
(
Branch
!=
{
Parent
}
)
{
assert
loggedInUser
==
Tester
:
"
Only tester can reopen this ticket.
"
;
assert
Branch
!=
{
Ticket
}
:
"
Fixed tickets in ticket branch should be merged to integration, not reopened.
"
;
}
//
workflow within the feature is free
}
transit to
In Progress
 
on
tests passed
[
always
]
do
{
if
(
Branch
!=
{
Parent
}
)
{
if
(
(
Type
!=
{
Hotfix
}
)
)
{
assert
loggedInUser
==
Tester
:
"
Only tester can mark this ticket verified.
"
;
}
assert
Branch
!=
{
Ticket
}
:
"
Tickets in ticket branch are not sent for tests yet, so they cannot be marked as verified.
"
;
}
//
workflow within the feature is free
}
transit to
Verified
}
 
state
Verified
{
 
}
 
}