Master data management Β· features 286-305
πŸ›’οΈ SQL Server Β· MasterDataLabDB
πŸ”€

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