Based on the current system integration requirements, the system provides a tag-based workflow integration method. When a workflow starts and executes the next step, it must be processed by identification. This makes JSP-based process integration very simple.
The system provides the startup parameters, which only need to be submitted to/flow/startprocessactivity. Do. The submitted parameters include: (refer to processrunstart. JS)
- Defid: required. Process Definition ID, that is, the primary key in the pro_definition table.
- Startflow: required. If the value is true, the START process is required.
- Destname: target node. When the Start Node has more than two branches, you can specify this value to determine the target node to jump to after the process starts. If this value is not specified, by default, it will jump to the first node.
- Flowassignid: The operator of the target node. Its format is node 1: node 2 | Node 1 executor IDs: node 2 executes IDs. The format of node IDS is 1, 2, 3. If no operator is specified, the operator specified by the node in the later stage is used.
- Usetemplate: The default value is false, indicating that the value is saved in the online form of the background. If the template form is used, the value is set to true.
- Sendmail: The default value is false. "True" indicates the person who sends the email notification.
- Sendmsg: The default value is false. If it is true, it indicates to-do recipients who send SMS notifications.
If tags are called, you can simplify the use of the startup process.
Example of calling the start tag:
Java code[Url =] [/url]
- <% @ Taglib prefix = "flow" tagdir = "/WEB-INF/tags/flow" %>
- <Flow: Start curuserid = "1" defid = "1">
- <Table cellpadding = "0" cellspacing = "1" border = "1">
- <Tr>
- <TD> my business forms </TD>
- </Tr>
- <Tr>
- <TD>
- XX: <input type = "text" name = "XXX"/>
- <Input type = "hidden" name = "afterhandler" value = "axxxservice. aamethod"/>
- <Input type = "hidden" name = "prehandler" value = "axxxservice. aamethod"/>
- </TD>
- </Tr>
- </Table>
- </Flow: Start>
The start tag contains only two parameters. curuserid indicates the ID of the currently started process, defid indicates the process definition ID, and the section marked in the middle is its own business form, you can add prehandler and afterhandler parameter values to your business form, for example, <input type = "hidden" name = "afterhandler" value = "xxservice. xxmethod "/>
When a workflow is started, you only need to specify the parameter corresponding to the afterhandler method. The value format is xxxxservice. xxmethod. If this value is specified, the bean of xxservice is searched from the spring container and its xxmethod method is called after the workflow is started. The format of xxmethod is as follows:
Integer xxmethod (flowflowruninfo flowruninfo );
Flowflowruninfo contains information about the process. If you change the name of the to-do list in the process, you can call this method:
Processrun = flowruninfo. getprocessrun ();
Processrun. setsubject ("XXX Approval Process ");
Processrunservice. Save (processrun );
Add your own business variables to the process, which can be called as follows:
Map map = new hashmap ();
Map. Put ("pkid", XX. GETID ());
Executionservice. setvariables (processrun. getpiid (), MAP );
Or call it in the following way:
Flowruninfo. getflowvars (). Put ("pkid", XX. GETID ());
XX. GETID () indicates to obtain the ID key value in the XX object variable, which can be obtained in the subsequent process.
To obtain the business method in the form, you can use flowruninfo. getrequest () to obtain the httpservletrequest object. To obtain automatically encapsulated entities in a business form, you can name them in the business form in the following way, as shown in
<Input type = "text" name = "salesorder. orderno" value = "XXX"/>
In the xxmethod method, you can automatically assemble the parameters whose names start with salesorder into the salesorder object. You need to call them as follows:
Java code[Url =] [/url]
- Salesorder = new salesorder ();
- Try {
- Beanutil. populateentity (flowruninfo. getrequest (), salesorder, "salesorder ");
- } Catch (exception ex ){
- Logger. Error (ex. getmessage ());
- }
- Execute the next step for the custom Workflow
When the process executes the next step, you only need to submit the process form to/flow/nextprocess. Do and include the following parameters.
- Taskid: required. task id in jbpm
- Destname: target node. When the Start Node has more than two branches, you can specify this value to determine the target node to jump to after the process starts. If this value is not specified, by default, it will jump to the first node.
- Flowassignid: The operator of the target node. Its format is node 1: node 2 | Node 1 executor IDs: node 2 executes IDs. The format of node IDS is 1, 2, 3. If no operator is specified, the operator specified by the node in the later stage is used.
- Usetemplate: The default value is false, indicating that the value is saved in the online form of the background. If the template form is used, the value is set to true.
- Signvotetype: indicates the type of voting. When the current node is signed, it indicates that you need to participate in the signing. The decision of the current user to vote for the signing (1 = agree, 2 = refuse, 3 = abstain)
- Sendmail: The default value is false. "True" indicates the person who sends the email notification.
- Sendmsg: The default value is false. If it is true, it indicates to-do recipients who send SMS notifications.
The label usage is as follows:
Java code[Url =] [/url]
- <Flow: Next curuserid = "$ {Params. curuserid}" taskid = "$ {Params. taskid}">
- <Table>
- <Tr>
- <TD> my business forms </TD>
- </Tr>
- <Tr>
- <TD>
- Taskname: <input type = "text" name = "XXX"/>
- </TD>
- </Tr>
- </Table>
- </Flow: Next>
The prehandler parameter and afterhandler method can also be received in the tag like the start tag to facilitate the processing of the business form.
3. Specify the process form path in the background
Enter the background settings of a process as follows:
Set "use form template" and set the template type to JSP template on each node, and specify the path of the form for business execution in the URL.
Description of tag-based workflow startup and task execution Development