289Statuses
Allowed moves between statuses: the workflow.
Try it
Workflow
Statuses (status_def) and the allowed moves between them (status_transition)
Draft β
β Issue β
ISSUEDβ Void β VOID
Issued
β Receive all β
PAIDβ Receive part β PARTIALβ Void β VOID
Partly paid
β Receive rest β
PAID
Paid
final - no further moves
Void
final - no further moves
Can a document move?
| # | Document type | From status | To status | Action (button text) | Status | |
|---|---|---|---|---|---|---|
| 9 | INVOICE | DRAFT | ISSUED | Issue | Active | βοΈ |
| 10 | INVOICE | DRAFT | VOID | Void | Active | βοΈ |
| 11 | INVOICE | ISSUED | PARTIAL | Receive part | Active | βοΈ |
| 12 | INVOICE | ISSUED | PAID | Receive all | Active | βοΈ |
| 14 | INVOICE | ISSUED | VOID | Void | Active | βοΈ |
| 13 | INVOICE | PARTIAL | PAID | Receive rest | Active | βοΈ |
| 6 | ORDER | APPROVED | SHIPPED | Ship | Active | βοΈ |
| 7 | ORDER | APPROVED | CANCELLED | Cancel | Active | βοΈ |
| 1 | ORDER | DRAFT | SUBMITTED | Submit | Active | βοΈ |
| 2 | ORDER | DRAFT | CANCELLED | Cancel | Active | βοΈ |
| 5 | ORDER | REJECTED | DRAFT | Revise | Active | βοΈ |
| 8 | ORDER | SHIPPED | COMPLETED | Complete | Active | βοΈ |
| 3 | ORDER | SUBMITTED | APPROVED | Approve | Active | βοΈ |
| 4 | ORDER | SUBMITTED | REJECTED | Reject | Active | βοΈ |
Showing 1β14 of 14
π Learn: how this master is built table status_transition
Key points
- Composite FOREIGN KEY (entity_type, from_code) β status_def(entity_type, code).
- StatusService.canMove() is what a real document screen calls before changing a status.
Code
- Entity
domain/StatusTransition.java- Repository
repo/StatusTransitionRepository.java- Definition
MasterRegistry: "status-transitions"- Page / form
web/MasterController.java- Try-it panel
templates/tools/workflow.html- REST API
GET /api/status/ORDER/can-move?from=DRAFT&to=APPROVED
SQL to try in SSMS (database MasterDataLabDB)
SELECT t.entity_type, f.name AS from_status, t.action_name, s.name AS to_status FROM status_transition t JOIN status_def f ON f.entity_type = t.entity_type AND f.code = t.from_code JOIN status_def s ON s.entity_type = t.entity_type AND s.code = t.to_code;