Development of JBPM Artificial termination function
A manual termination is a process by which an administrator manages to stop the approval of any node in the management interface by a technical means. The current demand scenario is a large number of such as overtime, leave, go out and some administrative categories of the approval list stay in direct or Leapfrog Supervisor approval (part of the middle or high-level list, its direct or leapfrog is EMT President or CEO), the corresponding approver did not timely approval, resulting in difficulties in follow-up work.
First, the termination function is open to the system administrator or process administrator of the process, the process administrator or system administrator can terminate this type of list, the manual termination of the list is a special type of list, there are so-called death orders, such as the initiator has left or the order has expired, even if the list is not approved by the matter The other part is this kind of high-level general non-processing of the list (prior to the authorization function, the high-level can be the HR attendance or administrative type of the approval of the list of authority through the authorization function to authorize others), can be manually terminated. After the manual termination of the list how to deal with, such as the process manager according to the report statistics further analysis processing.
The main code is as follows:
Public void terminate (String processexecutionid) {processexecutionentity exe = processexecutiondao.querybyid (Processexecutionid); List<processtaskentity> tasklist = processtaskservice.querybyprocessexecutionid ( Processexecutionid); if (! Collectionutils.isempty (TaskList)) {for (processtaskentity taskentity : tasklist) {if ( ProcessTaskEntity.STATUS_INIT.equals (Taskentity.getstatus ())) {Taskentity.setstatus (processtaskentity.status_ Manual_fin), Taskentity.setmodifytime (New date ()), Taskentity.setfinishtime (New date ()), if ("Rob". Equals (Taskentity.getcreateusercode ())) {Taskentity.setcreateusercode (Oausercontext.getusercode ());} Taskentity.setmodifyusercode (Oausercontext.getusercode ());p rocesstaskservice.update (taskEntity);}} Exe.setstatus (Processexecutionentity.status_manual_finish); Exe.setmodifyusercode (OAUserContext.getUserCode ()); Exe.setmodifytime (New date ()); update (EXE); Jbpmoperatorservice.terminate (Exe.getprocessinStanceid ()); Exe.setstatus ("3");}
The above code is mainly for the jbpm extension class, after terminating execution, will query all the to-do tasks, including sign, Rob and so on, and then all the agents are set to State 3, that is, to terminate the work, JBPM core termination code in
Jbpmoperatorservice.terminate
Following:
public void Terminate (String processinstanceid) {Executionservice Executionservice = Processengine.getexecutionservice (); if (executionservice! = null) {executionservice.endprocessinstance ( Processinstanceid, "cancle");} else {}}
After the code is all terminated, you need to modify the logic of advanced queries and reports to increase the state of manual termination. At present, the manual termination is mainly used in the business level for type 2, that is, to assist the high-level approval of non-EMT level of the process list, and death orders mainly by deleting the way.
This article is from the "Jiangnan Miner Technology Space" blog, please be sure to keep this source http://jncumter.blog.51cto.com/812546/1766974
Development of JBPM Artificial termination