LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.
Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.
talk is cheap, show others the code and KPI, Keep progress,make a better result.
Survive during the day and develop at night.
catalogue
summary
Process definition ZIp deployment: insert code snippets here
1, Implement the student leave process
Generate bpmn and png files with activiti plug-in:
ublic class StudentLeaveProcess { /** * Get the default process engine instance, and the activiti.cfg.xml file will be read automatically */ private ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine(); /** * Deployment process definition */ @Test public void test_Deploy() { Deployment deployment = processEngine.getRepositoryService() // Get deployment related services .createDeployment() Create deployment .addClasspathResource("diagrams/StudentLeaveProcess.bpmn") // Load resource file .addClasspathResource("diagrams/StudentLeaveProcess.bpmn") // Load resource file .name("Student leave process") // Process name .deploy(); // deploy System.out.println("Process deployment ID:" + deployment.getId()); System.out.println("Process deployment Name:" + deployment.getName()); } }
Update process deployment table
Update process definition table
Update resource file table
Update system configuration table
The relevant processes are as follows:
1.2 example of startup process:
@Test public void start() { ProcessInstance instance=processEngine.getRuntimeService() // Runtime Service .startProcessInstanceByKey("StudentLeaveProcess"); // Process definition table act_ re_ KEY field value of procdef System.out.println("Process instance ID:"+instance.getId()); System.out.println("Process definition ID:"+instance.getProcessDefinitionId()); }
At this point, the student leave node of the process waits for Zhang San to complete the task:
Update execution object table
Update the identity contact form,
Update the user task table. Here is Zhang San's task
Update the active node history table, as shown in the figure below, Zhang San's task has not been completed, so END_TIME is null
Update the historical identity contact form. The process is here for now
Update the historical task table. At present, there are only Zhang San's tasks. Only Zhang San needs to complete the tasks.
Update the historical process instance table, because Zhang San has not completed the task, so END_TIME is null.
Update the historical task table. At present, there are only Zhang San's tasks.
1.3 view Zhang San's tasks
/** * View task */ @Test public void find_task() { List<Task> taskList=processEngine.getTaskService().createTaskQuery().taskAssignee("Zhang San").list(); for(Task task:taskList){ System.out.println("task ID:"+task.getId()); System.out.println("Task name:"+task.getName()); System.out.println("Task creation time:"+task.getCreateTime()); System.out.println("Task delegation:"+task.getAssignee()); System.out.println("Process instance ID:"+task.getProcessInstanceId()); } }
1.4 Zhang San completes the task of asking for leave:
@Test
public void test_completeTask() {
processEngine.getTaskService().complete("2504");
}
analysis:
Update execution object table
Update the identity contact form. Up to now, Zhang San and Li Si need two users. Zhang San has completed the task
Update the user task table. Here is Li Si's task
Update the active node history table, as shown in the figure below, Li Si's task has not been completed, so END_TIME is null
Update historical identity contact form
Update historical process instance table
Update historical task table:
/** * View task */ @Test public void find_task() { List<Task> taskList=processEngine.getTaskService().createTaskQuery().taskAssignee("Li Si").list(); for(Task task:taskList){ System.out.println("task ID:"+task.getId()); System.out.println("Task name:"+task.getName()); System.out.println("Task creation time:"+task.getCreateTime()); System.out.println("Task delegation:"+task.getAssignee()); System.out.println("Process instance ID:"+task.getProcessInstanceId()); } }
1.6 Li Si completes the approval task of the monitor
/** * Complete the task */ @Test public void test_completeTask() { processEngine.getTaskService().complete("5002"); }
Update execution object table
Update identity contact form
Update the user task table. Here is Wang Wu's task
Update the active node history table, as shown in the figure below, Wang Wu's task has not been completed, so END_TIME is null
Update historical identity contact form
Update historical process instance table
Update historical task table
1.7 view Wang Wu's task
* View task */ @Test public void find_task() { List<Task> taskList=processEngine.getTaskService().createTaskQuery().taskAssignee("Wang Wu").list(); for(Task task:taskList){ System.out.println("task ID:"+task.getId()); System.out.println("Task name:"+task.getName()); System.out.println("Task creation time:"+task.getCreateTime()); System.out.println("Task delegation:"+task.getAssignee()); System.out.println("Process instance ID:"+task.getProcessInstanceId()); } }
/**
*Complete the task
*/
@Test
public void test_completeTask() {
processEngine.getTaskService().complete("7502");
}
At the end of the process, the data of the run-time table (the table starting with act_ru) is cleared, and the data of the history table (the table starting with act_hi) is modified or added
Summary:
References and recommended readings
1. Link: reference material.