I want to store a document and then decide what workflow to apply to the document. That workflow will request users to perform actions on the document, and capture the actual actions performed. eg
DocId=2
Flow = 1.[Mr.X - Authenticate] 2.[Mr.Y - Verify/Reject] 3.[Mr.Z Accept/Reject]
What database architecture will support these tasks?
The schema for workflows is greatly affected by whether your workflows have branching or not. If all of your workflows are linear with no branching, the problem is much simpler, because the definition of a workflow configuration need only list the steps in the workflow, and a document workflow instance only needs to record the current step. If conditional branching or parallel steps are involved, you need to use some sort of hierarchical model for the steps (eg each workflow configuration step could have a pointer to parents and pointer to children). These are often stored in XML.
The simple case with no branching can look like this:
table: workflow_config (one row per workflow)
table: workflow_config_step (one row for each workflow step)
table: document_workflow (one row for each document)
table: document_workflow_step (one row for each action taken on the document)
Note that branching workflows need to carry much more information from stage to stage. In fact the "parameters" attribute may need to be in a separate crosslinked table. I'm only calling it a field here because you may use delimited or XML representation if very little data is needed.
The following is the skeleton of a potential architecture to support your application. It contains definitions of the tables, and columns in the tables, together with some example data for each table. Permitted transactions has two purposes: to generate the requested actions for a particular document in a particular state; and to validate actions when they are appllied to the database.
State
Value (PK)
Example Data
Initial
Authenticated
Verified
Rejected
Accepted
Flow
Flow ID (PK)
Description
Example Data
27,Authenticate and validate general document
Permitted Transition
Current State (PK)(FK)
Action Type (PK)(FK)
Result State (PK)(FK)
Flow ID (FK)
Example Data
Initial,Authenticate,Authenticated
Action Requested
User (PK)(FK)
Document (PK)(FK)
Action Type (PK)(FK)
Example Data
Mr.X,2,Authenticate
Document
Document ID
Current State (FK)
Example Data
2,Initial
Document Flow
Document (FK)
Flow (FK)
Example Date
2,27
User
Name
Example Data
Mr.X
Mr.Y
Mr.Z
Action Type
Value (PK)
Example Data
Authenticate
Verify
Reject
Accept
Action
Action Type (PK)(FK)
User (PK)(FK)
Document (PK)(FK)
Example Data
Authenticate,Mr.X,2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.