Below will be the current mainstream of the three workflow to introduce and compare, and then through the three process engine design a more typical process to show you the three process of creating the process. These three workflow engines are Windows Workflow foundation,netbpm, respectively, Ccflow.
NETBPM and Ccflow are two domestic well-known open source software, especially ccflow in the domestic development momentum strong.
This typical process hypothesis: the company has two levels of leadership, the first level for the Boss chief
Scenario Description:
In a company, department employee leave needs the approval of the Supervisor chief.
If the number of days of vacation is greater than 10 days, the boss bosses must approve it after the department supervisor agrees.
If the department head is absent, submit it directly to the boss for approval.
The applicant may withdraw the leave application before the leave is approved.
After applying for approval, make changes to the days of leave (or other business data processing). After each leave application is completed, it must be recorded regardless of whether it is passed or canceled.
At the end of the process, the system should email the result information of the leave to the applicant.
For applications greater than 10 days, if the department supervisor has approved the approval and the supervisor has not approved, then the applicant revocation of the application, the system should send an email Notification Department Supervisor application has been revoked.
Here we are just a simulation, of course, real life situation is more complicated than this;
Windows Workflow Foundation
Microsoft's Workflow products provide a workflow engine and a process designer that comes with the VS solution, but the process designer faces a programmer rather than a business person, so the interface is more professional, the process runs only to create console applications, there is no process run interface, there is no form library, and requires two development of forms and interfaces.
Create a process using WWF:
1. Start VS2010 and create a program for the sequential Workflow console.
2. Enter the project name and click OK to automatically enter the process design interface.
3. The auto-generated Workflow1.cs is a workflow component.
4. Drag and drop a ifelse active component onto the design screen in the toolbox.
5. At this time, more coding work and form interface design work, such as in the left branch of IdelseBranchActivitiy1, to determine whether the absence of new applications for leave, or cancel the leave, activate the Conditiong attribute, and add the internal event Evaluateqingjianovalidcode, and activate, in the internal input logic code according to the database records to determine whether the leave pass, failed to cancel the leave. You can also go to another branch Evaluateqingjiacode continue to apply for a new leave;
6. Drag-and-drop the parallelActivity1 component after the IfElse node, to determine whether the leave person is chief, The Executecode handler that sets the CodeActivity3 property in SequenceActivity1 is Evaluatechiefnovalidcode and activated, and the internal code is used to determine if it is not chief. Another branch of the SequenceActivity1 is judged to be the case of Chief;
7. If not chief leave, you need to evaluatechiefnovalidcode in the logical judgment and form design, fill out the request for leave, and drag and drop ifelse components, the implementation of CODEACTIVITY6 code in order to determine the situation is greater than 10 days.
8.F5 can run a console program, where data that is not passed or canceled is required to be recorded, implemented through code and design databases, and code is required to send an email, and the WWF does not provide this capability.
The flowchart of the WWF design is as follows:
netbpm
From JBPM1 porting to the open source Workflow project under the. NET platform, two times development has some difficulty, because its use of the castle framework has many sub-projects, more technical points, need one by one familiar before the process of two development.
To create a workflow process using NETBPM:
1. One of the difficult points of using netbpm is to understand the build configuration file and submit the leave order configuration as follows:
?
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 66676869707172 |
<?
xml version
=
"1.0"
?>
<!-- NOTE:在定义流程时,建议先画出流程图,然后再来定义,这样思维清晰,也不易于出错
关于processdefiniton.xml如何定义,请严格按照nPdl规定 -->
<
process-definition
>
<!-- =================================== -->
<!-- == PROCESS DEFINITION PROPERTIES == -->
<!-- =================================== -->
<
name
>请假DEMO</
name
>
<
description
>该流程模拟公司的请假流程, </
description
>
<
responsible
>ae</
responsible
>
<!-- ====================== -->
<!-- == START & ENDSTATE == -->
<!-- ====================== -->
<
start-state name
=
"start leave request"
>
<
description
>提交请假单</
description
>
<!-- 定义了role,引擎在该start-state节点执行时,就会把执行者信息赋值给角色对应的属性“requester” -->
<
role
>requester</
role
>
<!-- 在这里定义start-state的field,它表示该filed相关联的属性,并且在该state,它对属性的访问权利。
如果需要定义其在web表单上的操作界面,如何进行web表单显示等,需要在webinterface.xml文件对应节点补充该field -->
<
field attribute
=
"start date" access
=
"write-only-required" />
<
field attribute
=
"end date"
access
=
"write-only-required" />
<
field attribute
=
"leave days"
access
=
"write-only-required" />
<
field attribute
=
"comment"
access
=
"write-only" />
<
transition to
=
"Is Cancel Fork" />
</
start-state
>
<!-- 结束节点除名称外不要定义其他-->
<
end-state name
=
"end" />
<!-- ====================== -->
<!-- == Actions == -->
<!-- ====================== -->
<!-- 解释:这里定义process-definition节点的action,有效的事件类型为:process-instance-start, process-instance-end and process-instance-cancel -->
<!-- 此处具体为:在流程结束的时候, 发送E-Mail消息给申请者,记录请假日志 -->
<
action event
=
"process-instance-end"
handler
=
"NetBpm.Example.LeaveOfAbsence.EmailAction, NetBpm.Example.LeaveOfAbsence"
on-exception
=
"log"
>
<!--定义action参数,供委托类实例化类调用方法时获取使用。如这里的EmailAction的run方法发送邮件,需要知道发给谁,邮件标题等等,那么
参数可以提供辅助-->
<
parameter name
=
"to"
>previousActor</
parameter
>
<
parameter name
=
"subject"
>您提交了请假申请</
parameter
>
<
parameter name
=
"message"
>you requested a holiday from ${start date} to ${end date} with comment ${comment}</
parameter
>
</
action
>
<!-- 此处具体为:在流程结束的时候记录请假日志, 此处Log模拟 注意:每个节点可以定义多个action -->
<
action event
=
"process-instance-end"
handler
=
"NetBpm.Example.LeaveOfAbsence.LogLeaveInfoAction, NetBpm.Example.LeaveOfAbsence"
on-exception
=
"log"
>
<
parameter name
=
"LogInfo"
>记录请假日志? :) </
parameter
>
</
action
>
<!-- ================ -->
<!-- == ATTRIBUTES == -->
<!-- ================ -->
<!-- 解释:定义属性值及其序列化方式。属性值一般包括3类 -->
<!-- one:角色对应的属性 -->
<
attribute name
=
"requester" type
=
"actor" />
<
attribute name
=
"chief" type
=
"actor" />
<
attribute name
=
"boss" type
=
"actor" />
<!-- two:所有acitivity-state(包括start-state)处需要更新的属性,和用户表单内容对应 -->
<
attribute name
=
"start date" type
=
"date" />
<
attribute name
=
"end date" type
=
"date" />
<
attribute name
=
"leave days" type
=
"integer" />
<
attribute name
=
"comment" type
=
"text" initial-value
=
"请假理由或者备注" />
<
attribute name
=
"Chief evaluation result" type
=
"evaluation" />
<
attribute name
=
"Boss evaluation result" type
=
"evaluation" />
</
concurrent-block
>
</
process-definition
>
|
2. Other configuration file code is too long to be pasted out;
3. Define the delegate class: The delegate class is contained in the Assembly under the Lib folder.
Because of the large number of delegate classes, only a few typical delegate classes are posted here:
1. NetBpm.Example.LeaveOfAbsence.AutoSetAttributionsAction: The delegate class is designed as a generic delegate class, which is used to set the table properties, such as the process after the user cancels the leave path, The Runtrace attribute is set to Requestercancel for whichwaydicision to be used for judgment.
2. NetBpm.Example.LeaveOfAbsence.AnyOneJoin: This delegate is used primarily to set the activation parent flow mechanism, where the parent flow is activated as long as any one of the paths reaches the join.
3. NetBpm.Example.LeaveOfAbsence.WhichWayDecision: The delegate according to the flow of actual flows through the path, according to the identity of the attribute runtrace, such as the choice of which side to go.
4. This article is just an example of a reference to using NPDL to define the NETBPM process, and it is clear that a lot of optimization is needed if the process is to be put into practice. The amount of code in it is still very large.
The flowchart under NETBPM design is as follows:
CC Flow
Ccflow is a homegrown open source workflow. Supports SQL Server, Oracle, Access, MySQL database, supports cluster computing, and supports multiple languages. Process design, form design are visualized, WYSIWYG. Ccflow provides powerful data analysis capabilities: A variety of reports, graphs, mining, and earning of process operations, which can be used for real (time) validity, cost analysis (manpower, time, property), and all-round analysis and monitoring. Ccflow more with Mobile + mobile phone + SMS + SMS Cat + Email Seamless connection, let your work the first time to communicate, the first time to deal with.
Create a workflow process using CC flow:
1. After installing the program in the Web container, open the process designer, establish the leave process, you can generate fill out the leave and end nodes;
2. Drag the chief Approval node, Boss approval node, add lines and label notes;
3. Set up a form: Mail Select a dummy form or a free type form, set up the form, and set up each node's work position;
4. Set the process jump direction conditions, such as determine who the lover is, determine the number of days of leave, etc., the selected data to originate from the form data.
5. Click Run to run the process, you can open the Windows service, you can use your own message alert and mail sending function;
The flow chart for CC flow design is as follows:
In summary, the three workflow differences are shown in the following table:
Related software links in this article:
Ccflow:http://www.oschina.net/p/ccflow problems in use can be contacted with @ccflow
netbpm:http://www.oschina.net/p/netbpm
jbpm:http://www.oschina.net/p/jbpm
Wwf:http://msdn.microsoft.com/zh-cn/library/aa480214.aspx