Content:
1, design logistics distribution process
2. Start the logistics distribution process
3. Query Group task, pick Group task
4. Query personal tasks and personal tasks
1. Design the logistics distribution process
Logistics and distribution process
Task assignment based on group tasks, using exclusive gateways, branching selection using process variable implementations
Activiti Graphical Interface:
The ID value of the process corresponds to the key value in the flow definition table and can be used to start the latest version of the process instance
In the Task node:
The general ID value corresponds to the Task_def_key value in the task table that defines the method name for the task in Taskaction in the project Taskdefinitionkey
The value of the candidate Grops property of the Main config corresponds to the name of the roles role, the ID value of group in the Activiti table (role and group synchronization are saved when the value of the group Id should be set to the name of role, Because the ID value is UUID is not easy to read)
exclusive Gateway, branch selection using process variable implementation, condition expression in condition gets the value in the process variable to determine true or false to select branch
2. Start the process delivery process
Step One: Provide a list method in the work order Management workordermanageaction to query a work order with a start status of "0"
Service Code:
[Java] view plain copy public list<workordermanage> Findlistnotstart () {Detachedcriteria Detachedc Riteria = Detachedcriteria. Forclass (Workordermanage.class); Add Condition: Start = = 0 Detachedcriteria.add (restrictions.eq ("Start", "0")); Return workordermanagedao.findbycondition (Detachedcriteria); }
Step two : Configure Struts.xml
Step three : Provide startranster.jsp page, show work order
Fourth Step : Start the Logistics delivery process by providing the Start method in the Work Order management action
Service Code:
Get the Workordermanage object by ID set start status to 1 start state, and start the logistics delivery process instance
[Java] View Plain copy @Resource private processengine processengine; Start the logistics distribution process, set the work order object to the process variable public void start (String id) {Workordermanage workordermanage = Workordermanagedao.fin Dbyid (ID); Workordermanage.setstart ("1"); String Processdefinitionkey = "transfer";//Logistics Distribution Process key map<string, object> variables = new hashmap<string, O Bject> (); Variables.put ("Business Data", workordermanage); Processengine.getruntimeservice (). Startprocessinstancebykey (Processdefinitionkey, variables); }
3. Query group Tasks
First step : Create a taskaction, provide findgrouptask, query the group (public) task of the currently logged on user
[Java] View plain copy @Controller @Scope ("prototype") public class taskaction extends actionsupport { @ resource private ProcessEngine processEngine; /** * Query group tasks */ public string findgrouptask () { // Task Queries taskquery query = processengine.gettaskservice (). Createtaskquery (); string candidateuser = boscontext.getloginuser ( ). GetId ();