Search code examples
c#umlstate-diagram

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.


Solution

  • 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.