16.1 Data structure
The current process information is not saved to any one of the sustainable environment, according to the suggestions of users, increase the function of storing workflow XML files. This feature is implemented using a database, and you can have more persistent ways.
Depending on the implementation of the workflow engine, some engines require only an XML file configuration, and some engines need to build a database model. In this article, assume that the workflow engine is related to the database.
The whole persistence process is like this:
Download the appropriate process XML description from the server using WebServices (or create a new process)
Process design or modification by using the process designer on the client, where any modifications are done locally
After the user clicks on the Save button, the corresponding XML string is generated according to the current process and uploaded to the server via WebServices.
Parse the XML file on the server and update the corresponding data to the database
First you need to define the data tables for some workflows, including process tables, activity tables, and rule tables. Because process monitoring is not yet involved, the workflow instance table is not considered. In addition, in order to simplify the program, also did not configure the activity type, the rule type and so on auxiliary table, but directly in the related activity and the rule table set the related field.
Process table (workflow_process)
Field name |
Type |
Significance |
WorkflowId |
Pk,varchar (M), not nul |
Primary key |
Workflowname |
Nvarchar (M), not nul |
Process Name |
Workflowxm |
Ntext,not nul |
Process XML Description file |
Activity Table (workflow_activity)
Field name |
Type |
Significance |
ActivityID |
Pk,varchar (M), not nul |
Primary key |
Activityname |
Nvarchar (M), not nul |
Activity name |
Activitytype |
Varchar (M), not nul |
Activity type |
ProcessID |
Fk,varchar (M), not nul |
Associated Process ID |
Rules table (Workflow_rule)
Field name |
Type |
Significance |
RuleId |
Pk,varchar (M), not nul |
Primary key |
RuleName |
Nvarchar (M), not nul |
Rule name |
Beginactivityid |
Fk,varchar (M), nul |
Relevance of the Revelation activity |
Endactivityid |
Fk,varchar (M), nul |
Associated End Activity |
Condition |
Nvarchar (1000), nul |
Circulation conditions |
RuleType |
Varchar (M), not nul |
Rule type |
The following picture shows the relationship of these tables.
You can download this program source code and database backup file (sq2005 data backup file) in CodePlex
(Recent update is not so frequent, forgive me.) )