Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UML state diagram for N number of approvals

I am writing my first state diagram for an approvals matrix and I am stuck. An Order in our system will go through a number of states and transitions for approval:

States

  • Start (state)
  • (submit() transition)
  • Awaiting Approval (state)
  • (approve() transition)
  • Awaiting Approval (state)
  • (approve() transition)
  • ...
  • Live (state)

My problem is that the awaiting approval states will only transition to Live state when N number of approve() events, for each order, are received (an approval from one user will trigger a notification for approval from another user).

Should I add a decision point after the Awaiting Approval state that does a self transition back to Awaiting Approval OR progresses to Live state based on a count of approvals (is that allowed? Or am I missing something?)

Any help would be appreciated. Most state diagrams I look at are based on a set number of approvals, not a variable list.

like image 841
Sico Avatar asked Dec 06 '25 04:12

Sico


1 Answers

You will add a guard:

enter image description here

The approval trigger has a behavior inc approval count. Now the guard [approval count > N] will pass only if the counter is great enough.

like image 72
qwerty_so Avatar answered Dec 10 '25 20:12

qwerty_so



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!