How it works · Workflows

One operation, and the state machine decides

A workflow entity changes only through events. Every event of every workflow goes through the same PATCH /{entity}/{id}/{event}; the states XML says which events are allowed where, what each one needs and which code runs, and the response tells the client what it can do next.

A workflow event: one operation, the state machine decides Issue I-7 is in ASSIGNED. A client sends PATCH /issue/I-7/resolve. The pipeline types the payload and checks the event's authorities. StateEntityServiceImpl loads the issue and calls the state machine. It runs the exit action, the transition action the resolver finds (a tenant's own bean first) and a second transition action from another team, then passes through two automatic states, isCritical and autoCloseCheck, to the manual state RESOLVED, where the entry action stores the issue and the post-save hook runs. Variants show a caller without the authority (403), an event not allowed in the current state (422), and a tenant with its own transition action. The states XML · issue-states.xml (rounded = manual, dashed = automatic) OPENEDassign ASSIGNEDresolve <if>isCriticalno <auto-state>autoCloseCheckkeepOpen RESOLVEDclose CLOSED REVIEW_PENDING yes close I-7 is here ClientPATCH …/resolve chenile-highwaytyping · security StateEntityServiceImplprocessById(id, event, …) EntityStoreretrieve · store needs: issue.resolve STM.proceed · Finito automatic state? compute the next event and go again which transition?ASSIGNED --resolve--> exit actionof the old state transition actionissueResolveAction entry actionstore · SLA · post-save hook second actionsIssueMetricsAction · 1 component resolveracme… › issue… › default post-save hookissueRESOLVEDPostSaveHook response: the entity and its allowed actions, or the error
scenario
tenant
view
Step 1

Exchange

Payload

The flow is data

States, events, allowed transitions, their acls and their metadata live in the states XML. Adding an event is a line in the XML and, if it needs logic, one transition action; the controller and the service do not change.

Code is found by name

The XML names no classes. The transition action for an event is the bean named after the workflow and the event (issueResolveAction); automatic states and post-save hooks are found the same way, and a tenant's own bean wins over the base one.

The client is told what is next

Every response carries allowedActionsAndMetadata: the events allowed from the new state, already filtered by security, with each transition's metadata. User interfaces build their buttons from it.