【Activiti工作流引擎】官方快速入门demo

Activiti官方快速入门demo

地址:
https://www.activiti.org/quick-start

0. 版本

activiti 5.22.0
JDK 1.8

1. 介绍

这个快速入门指南用于介绍如何在你编写的应用程序中嵌入BPM(Business Process Management)框架Activiti,你可以构建一个基于命令行的BPMN(业务流程建模与标注)逻辑应用程序。
Activiti拥有先进的流程设计工具,可将更复杂的BPM逻辑嵌入到您的应用程序中。这些工具包括基于Eclipse和基于Web的BPMN编辑器等等。为简洁起见,本快速入门只使用Activiti的Java API。

2. 创建设设置Maven项目

使用以下Maven依赖项创建一个名为“ActivitiDeveloperQuickStart”(以下称为)的Java项目:
pom.xml文件内容为:


<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>

    <groupId>activitigroupId>
    <artifactId>activiti-demoartifactId>
    <version>1.0-SNAPSHOTversion>
    <dependencies>
        
        <dependency>
            <groupId>org.activitigroupId>
            <artifactId>activiti-engineartifactId>
            <version>5.22.0version>
        dependency>
        
        <dependency>
            <groupId>org.slf4jgroupId>
            <artifactId>slf4j-apiartifactId>
            <version>1.7.21version>
        dependency>
        <dependency>
            <groupId>org.slf4jgroupId>
            <artifactId>slf4j-log4j12artifactId>
            <version>1.7.21version>
        dependency>
        <dependency>
            <groupId>com.h2databasegroupId>
            <artifactId>h2artifactId>
            <version>1.4.193version>
        dependency>
        
        
        <dependency>
            <groupId>mysqlgroupId>
            <artifactId>mysql-connector-javaartifactId>
            <version>6.0.6version>
        dependency>
    dependencies>

    <build>
        <plugins>
            
            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-assembly-pluginartifactId>
                <version>2.4.1version>
                <configuration>
                    
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependenciesdescriptorRef>
                    descriptorRefs>
                    
                    <archive>
                        <manifest>
                            <mainClass>com.example.OnboardingRequestmainClass>
                        manifest>
                    archive>
                    <encoding>UTF-8encoding>
                configuration>
                <executions>
                    <execution>
                        <id>make-assemblyid>
                        
                        <phase>packagephase>
                        <goals>
                            <goal>singlegoal>
                        goals>
                    execution>
                executions>
            plugin>
        plugins>
    build>
project>

官方使用的数据库是H2,由于我想看一下表结构,所以这里我自己使用的是mysql数据库

3. 创建流程引擎

配置日志
D:\IDEAProject\activitidemo\src\main\resources\log4j.properties

log4j.rootLogger=DEBUG, ACT

log4j.appender.ACT=org.apache.log4j.ConsoleAppender
log4j.appender.ACT.layout=org.apache.log4j.PatternLayout
log4j.appender.ACT.layout.ConversionPattern= %d{hh:mm:ss,SSS} [%t] %-5p %c %x - %m%n

创建一个带main方法的类

D:\IDEAProject\activitidemo\src\main\java\com\example\OnboardingRequest.java

package com.example;

public class OnboardingRequest {
    public static void main(String[] args) {

    }
}

使用Java代码的方式创建流程引擎

public class OnboardingRequest {
    public static void main(String[] args) throws ParseException {
        ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration()
                .setJdbcUrl("jdbc:mysql://localhost:3306/activiti?serverTimezone=UTC")
                .setJdbcUsername("root")
                .setJdbcPassword("123456")
                .setJdbcDriver("com.mysql.jdbc.Driver")
                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        ProcessEngine processEngine = cfg.buildProcessEngine();
        String pName = processEngine.getName();
        String ver = ProcessEngine.VERSION;
        System.out.println("ProcessEngine [" + pName + "] Version: [" + ver + "]");
    }
}

FatJar也就叫做UberJar,是一种可执行的Jar包(Executable Jar)。FatJar和普通的jar不同在于它包含了依赖的jar包。
在第一步中已经把中加入了fatjar的配置

运行OnboardingRequest.java,运行成功后数据库会出现25张表

4. 部署流程实例

官方提供的Onboarding(入职)流程是:
1. 输入数据
2. 经验大于3年,发布个性化入职欢迎消息
3. 工作经验3年或者以下,直接把数据存入后端系统

官方提供的是xml配置文件
/ src / main / resources / onboarding.bpmn20.xml


<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
  <process id="onboarding" name="Onboarding" isExecutable="true">
    <startEvent id="startOnboarding" name="Start" activiti:initiator="initiator">startEvent>
    <userTask id="enterOnboardingData" name="Enter Data" activiti:assignee="${initiator}" activiti:candidateGroups="managers">
      <extensionElements>
        <activiti:formProperty id="fullName" name="Full Name" type="string">activiti:formProperty>
        <activiti:formProperty id="yearsOfExperience" name="Years of Experience" type="long" required="true">activiti:formProperty>
      extensionElements>
    userTask>
    <sequenceFlow id="sid-1337EA98-7364-4198-B5D9-30F5341D6918" sourceRef="startOnboarding" targetRef="enterOnboardingData">sequenceFlow>
    <exclusiveGateway id="decision" name="Years of Experience" default="automatedIntroPath">exclusiveGateway>
    <sequenceFlow id="sid-42BE5661-C3D5-4DE6-96F5-73D34822727A" sourceRef="enterOnboardingData" targetRef="decision">sequenceFlow>
    <userTask id="personalizedIntro" name="Personalized Introduction and Data Entry" activiti:assignee="${initiator}" activiti:candidateGroups="managers">
      <extensionElements>
        <activiti:formProperty id="personalWelcomeTime" name="Personal Welcome Time" type="date" datePattern="MM-dd-yyyy hh:mm">activiti:formProperty>
      extensionElements>
    userTask>
    <endEvent id="endOnboarding" name="End">endEvent>
    <sequenceFlow id="sid-37A73ACA-2E23-400B-96F3-71F77738DAFA" sourceRef="automatedIntro" targetRef="endOnboarding">sequenceFlow>
    <scriptTask id="automatedIntro" name="Generic and Automated Data Entry" scriptFormat="javascript" activiti:autoStoreVariables="false">
      <script>var dateAsString = new Date().toString();
execution.setVariable("autoWelcomeTime", dateAsString);]]>script>
    scriptTask>
    <sequenceFlow id="automatedIntroPath" sourceRef="decision" targetRef="automatedIntro">sequenceFlow>
    <sequenceFlow id="personalizedIntroPath" name=">3" sourceRef="decision" targetRef="personalizedIntro">
      <conditionExpression xsi:type="tFormalExpression"> 3}]]>conditionExpression>
    sequenceFlow>
    <sequenceFlow id="sid-BA6F061B-47B6-428B-8CE6-739244B14BD6" sourceRef="personalizedIntro" targetRef="endOnboarding">sequenceFlow>
  process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_onboarding">
    <bpmndi:BPMNPlane bpmnElement="onboarding" id="BPMNPlane_onboarding">
      <bpmndi:BPMNShape bpmnElement="startOnboarding" id="BPMNShape_startOnboarding">
        <omgdc:Bounds height="30.0" width="30.0" x="155.0" y="145.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="enterOnboardingData" id="BPMNShape_enterOnboardingData">
        <omgdc:Bounds height="80.0" width="100.0" x="240.0" y="120.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="decision" id="BPMNShape_decision">
        <omgdc:Bounds height="40.0" width="40.0" x="385.0" y="140.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="personalizedIntro" id="BPMNShape_personalizedIntro">
        <omgdc:Bounds height="80.0" width="100.0" x="519.0" y="15.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endOnboarding" id="BPMNShape_endOnboarding">
        <omgdc:Bounds height="28.0" width="28.0" x="725.0" y="165.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="automatedIntro" id="BPMNShape_automatedIntro">
        <omgdc:Bounds height="80.0" width="100.0" x="520.0" y="255.0">omgdc:Bounds>
      bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-37A73ACA-2E23-400B-96F3-71F77738DAFA" id="BPMNEdge_sid-37A73ACA-2E23-400B-96F3-71F77738DAFA">
        <omgdi:waypoint x="570.0" y="255.0">omgdi:waypoint>
        <omgdi:waypoint x="570.0" y="179.0">omgdi:waypoint>
        <omgdi:waypoint x="725.0" y="179.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-1337EA98-7364-4198-B5D9-30F5341D6918" id="BPMNEdge_sid-1337EA98-7364-4198-B5D9-30F5341D6918">
        <omgdi:waypoint x="185.0" y="160.0">omgdi:waypoint>
        <omgdi:waypoint x="240.0" y="160.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="automatedIntroPath" id="BPMNEdge_automatedIntroPath">
        <omgdi:waypoint x="405.0" y="180.0">omgdi:waypoint>
        <omgdi:waypoint x="405.0" y="295.0">omgdi:waypoint>
        <omgdi:waypoint x="520.0" y="295.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="personalizedIntroPath" id="BPMNEdge_personalizedIntroPath">
        <omgdi:waypoint x="405.0" y="140.0">omgdi:waypoint>
        <omgdi:waypoint x="405.0" y="55.0">omgdi:waypoint>
        <omgdi:waypoint x="519.0" y="55.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-42BE5661-C3D5-4DE6-96F5-73D34822727A" id="BPMNEdge_sid-42BE5661-C3D5-4DE6-96F5-73D34822727A">
        <omgdi:waypoint x="340.0" y="160.0">omgdi:waypoint>
        <omgdi:waypoint x="385.0" y="160.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-BA6F061B-47B6-428B-8CE6-739244B14BD6" id="BPMNEdge_sid-BA6F061B-47B6-428B-8CE6-739244B14BD6">
        <omgdi:waypoint x="619.0" y="55.0">omgdi:waypoint>
        <omgdi:waypoint x="739.0" y="55.0">omgdi:waypoint>
        <omgdi:waypoint x="739.0" y="165.0">omgdi:waypoint>
      bpmndi:BPMNEdge>
    bpmndi:BPMNPlane>
  bpmndi:BPMNDiagram>
definitions>

这里要注意的是:
“Enter Data”节点有2个参数fullName和yearsOfExperience,candidate groups设置为managers
“Personalized Introduction and Data Entry”节点有1个参数personalWelcomeTime,candidate groups设置为managers
“Years of Experience”网关判断节点的条件是${yearsOfExperience > 3},默认走automatedIntroPath

修改OnboardingRequest.java,部署流程实例

package com.example;

import java.text.ParseException;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;

public class OnboardingRequest {
  public static void main(String[] args) throws ParseException {
    ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration()
        .setJdbcUrl("jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000")
        .setJdbcUsername("sa")
        .setJdbcPassword("")
        .setJdbcDriver("org.h2.Driver")
        .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
    ProcessEngine processEngine = cfg.buildProcessEngine();
    String pName = processEngine.getName();
    String ver = ProcessEngine.VERSION;
    System.out.println("ProcessEngine [" + pName + "] Version: [" + ver + "]");

    RepositoryService repositoryService = processEngine.getRepositoryService();
    Deployment deployment = repositoryService.createDeployment()
        .addClasspathResource("onboarding.bpmn20.xml").deploy();
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
        .deploymentId(deployment.getId()).singleResult();
    System.out.println(
        "Found process definition [" 
            + processDefinition.getName() + "] with id [" 
            + processDefinition.getId() + "]");
  }
}

5. 启动流程实例

已经部署的流程实例,可以通过Activiti API来启动,运行,查看历史记录,并以其他方式管理流程实例
日志级别可以继续使用DEBUG,这里不修改,比较方便可以看到修改和查询了哪些表格

修改OnboardingRequest.java,启动一个流程

package com.example;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

import org.activiti.engine.FormService;
import org.activiti.engine.HistoryService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.form.FormData;
import org.activiti.engine.form.FormProperty;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration;
import org.activiti.engine.impl.form.DateFormType;
import org.activiti.engine.impl.form.LongFormType;
import org.activiti.engine.impl.form.StringFormType;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

public class OnboardingRequest {
  public static void main(String[] args) throws ParseException {
    ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration()
        .setJdbcUrl("jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000")
        .setJdbcUsername("sa")
        .setJdbcPassword("")
        .setJdbcDriver("org.h2.Driver")
        .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
    ProcessEngine processEngine = cfg.buildProcessEngine();
    String pName = processEngine.getName();
    String ver = ProcessEngine.VERSION;
    System.out.println("ProcessEngine [" + pName + "] Version: [" + ver + "]");

    RepositoryService repositoryService = processEngine.getRepositoryService();
    Deployment deployment = repositoryService.createDeployment()
        .addClasspathResource("onboarding.bpmn20.xml").deploy();
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
        .deploymentId(deployment.getId()).singleResult();
    System.out.println(
        "Found process definition [" 
            + processDefinition.getName() + "] with id [" 
            + processDefinition.getId() + "]");

    RuntimeService runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance = runtimeService
        .startProcessInstanceByKey("onboarding");
    System.out.println("Onboarding process started with process instance id [" 
        + processInstance.getProcessInstanceId()
        + "] key [" + processInstance.getProcessDefinitionKey() + "]");

    TaskService taskService = processEngine.getTaskService();
    FormService formService = processEngine.getFormService();
    HistoryService historyService = processEngine.getHistoryService();

    Scanner scanner = new Scanner(System.in);
    while (processInstance != null && !processInstance.isEnded()) {
      List tasks = taskService.createTaskQuery()
          .taskCandidateGroup("managers").list();
      System.out.println("Active outstanding tasks: [" + tasks.size() + "]");
      for (int i = 0; i < tasks.size(); i++) {
        Task task = tasks.get(i);
        System.out.println("Processing Task [" + task.getName() + "]");
        Map variables = new HashMap();
        FormData formData = formService.getTaskFormData(task.getId());
        for (FormProperty formProperty : formData.getFormProperties()) {
          if (StringFormType.class.isInstance(formProperty.getType())) {
            System.out.println(formProperty.getName() + "?");
            String value = scanner.nextLine();
            variables.put(formProperty.getId(), value);
          } else if (LongFormType.class.isInstance(formProperty.getType())) {
            System.out.println(formProperty.getName() + "? (Must be a whole number)");
            Long value = Long.valueOf(scanner.nextLine());
            variables.put(formProperty.getId(), value);
          } else if (DateFormType.class.isInstance(formProperty.getType())) {
            System.out.println(formProperty.getName() + "? (Must be a date m/d/yy)");
            DateFormat dateFormat = new SimpleDateFormat("m/d/yy");
            Date value = dateFormat.parse(scanner.nextLine());
            variables.put(formProperty.getId(), value);
          } else {
            System.out.println("
"); } } taskService.complete(task.getId(), variables); HistoricActivityInstance endActivity = null; List activities = historyService.createHistoricActivityInstanceQuery() .processInstanceId(processInstance.getId()).finished() .orderByHistoricActivityInstanceEndTime().asc() .list(); for (HistoricActivityInstance activity : activities) { if (activity.getActivityType() == "startEvent") { System.out.println("BEGIN " + processDefinition.getName() + " [" + processInstance.getProcessDefinitionKey() + "] " + activity.getStartTime()); } if (activity.getActivityType() == "endEvent") { // Handle edge case where end step happens so fast that the end step // and previous step(s) are sorted the same. So, cache the end step //and display it last to represent the logical sequence. endActivity = activity; } else { System.out.println("-- " + activity.getActivityName() + " [" + activity.getActivityId() + "] " + activity.getDurationInMillis() + " ms"); } } if (endActivity != null) { System.out.println("-- " + endActivity.getActivityName() + " [" + endActivity.getActivityId() + "] " + endActivity.getDurationInMillis() + " ms"); System.out.println("COMPLETE " + processDefinition.getName() + " [" + processInstance.getProcessDefinitionKey() + "] " + endActivity.getEndTime()); } } // Re-query the process instance, making sure the latest state is available processInstance = runtimeService.createProcessInstanceQuery() .processInstanceId(processInstance.getId()).singleResult(); } scanner.close(); } }

直接运行OnboardingRequest.java
输入:joy
输入:2
可以看到输出结果:

-- Start [startOnboarding] 21 ms
-- Enter Data [enterOnboardingData] 6456 ms
-- Years of Experience [decision] 12 ms
-- Generic and Automated Data Entry [automatedIntro] 6 ms
-- End [endOnboarding] 0 ms

再次运行
输入:wang
输入:5
可以看到输出结果:

-- Start [startOnboarding] 8 ms
-- Enter Data [enterOnboardingData] 4505 ms
-- Years of Experience [decision] 13 ms
-- Personalized Introduction and Data Entry [personalizedIntro] 16981 ms
-- End [endOnboarding] 0 ms

工作经验为2年的,会走脚本流程”Generic and Automated Data Entry”,然后流程结束
工作经验为5年的,会走“Personalized Introduction and Data Entry”流程,然后流程结束

6. 用Java编写任务

上面的测试当工作经验小于或者为3年的时候,会走一个JS脚本的流程,这里把它改成Java代码输出的脚本

/src/main/java/com/example/AutomatedDataDelegate.java

package com.example;

import java.util.Date;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;

public class AutomatedDataDelegate implements JavaDelegate {

  @Override
  public void execute(DelegateExecution execution) throws Exception {
    Date now = new Date();
    execution.setVariable("autoWelcomeTime", now);
    System.out.println("Faux call to backend for [" 
    + execution.getVariable("fullName") + "]");
  }

}

修改/src/main/resources/onboarding.bpmn20.xml

    <scriptTask id="automatedIntro" name="Generic and Automated Data Entry" scriptFormat="javascript" activiti:autoStoreVariables="false">
      <script>var dateAsString = new Date().toString();
execution.setVariable("autoWelcomeTime", dateAsString);]]>script>
    scriptTask>

替换成

id="automatedIntro" name="Generic and Automated Data Entry" activiti:class="com.example.AutomatedDataDelegate">

再进行测试

观察输出“Faux call to backend for [xxx]”,说明访问先前设置的过程变量

8. 分析

以一个全新的环境运行main
第一次运行的时候,输入joy1和年限为2年,从debug日志可以看出

1. 开始创建流程引擎之后,创建了25张表,然后流程引擎创建完毕

ACT_GE_PROPERTY默认数据是

08:55:51,189 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - SQL: insert into ACT_GE_PROPERTY 
values ('schema.version', '5.22.0.0', 1)
08:55:51,194 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - SQL: insert into ACT_GE_PROPERTY 
values ('schema.history', 'create(5.22.0.0)', 1)
08:55:51,195 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - SQL: insert into ACT_GE_PROPERTY 
values ('next.dbid', '1', 1)

2. 开始部署流程的时候,操作的表如下

先操作ACT_GE_PROPERTY表

09:01:05,769 [main] DEBUG org.activiti.engine.impl.persistence.entity.PropertyEntity.updateProperty  - ==>  Preparing: update ACT_GE_PROPERTY SET REV_ = ?, VALUE_ = ? where NAME_ = ? and REV_ = ? 
09:01:05,770 [main] DEBUG org.activiti.engine.impl.persistence.entity.PropertyEntity.updateProperty  - ==> Parameters: 2(Integer), 2501(String), next.dbid(String), 1(Integer)

查表ACT_RE_PROCDEF和ACT_RU_JOB

09:01:07,683 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectLatestProcessDefinitionByKey  - ==>  Preparing: select * from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null) and VERSION_ = (select max(VERSION_) from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null)) 
09:01:07,683 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectLatestProcessDefinitionByKey  - ==> Parameters: onboarding(String), onboarding(String)
09:01:07,694 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectLatestProcessDefinitionByKey  - <==      Total: 0
09:01:07,701 [main] DEBUG org.activiti.engine.impl.persistence.entity.JobEntity.selectJobByTypeAndProcessDefinitionKeyNoTenantId  - ==>  Preparing: select J.* from ACT_RU_JOB J inner join ACT_RE_PROCDEF P on J.PROC_DEF_ID_ = P.ID_ where J.HANDLER_TYPE_ = ? and P.KEY_ = ? and (P.TENANT_ID_ = '' or P.TENANT_ID_ is null) 
09:01:07,702 [main] DEBUG org.activiti.engine.impl.persistence.entity.JobEntity.selectJobByTypeAndProcessDefinitionKeyNoTenantId  - ==> Parameters: timer-start-event(String), onboarding(String)
09:01:07,714 [main] DEBUG org.activiti.engine.impl.persistence.entity.JobEntity.selectJobByTypeAndProcessDefinitionKeyNoTenantId  - <==      Total: 0

ACT_RE_PROCDEF插入数据

09:07:57,554 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert DeploymentEntity[id=1, name=null]
09:07:57,554 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert ProcessDefinitionEntity[onboarding:1:4]
09:07:57,554 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert ResourceEntity[id=2, name=onboarding.bpmn20.xml]
09:07:57,554 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert ResourceEntity[id=3, name=onboarding.onboarding.png]
09:07:57,555 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - flush summary: 4 insert, 0 update, 0 delete.
09:07:57,555 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - now executing flush...
09:07:57,555 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - inserting: ProcessDefinitionEntity[onboarding:1:4]
09:07:57,556 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.insertProcessDefinition  - ==>  Preparing: insert into ACT_RE_PROCDEF(ID_, REV_, CATEGORY_, NAME_, KEY_, VERSION_, DEPLOYMENT_ID_, RESOURCE_NAME_, DGRM_RESOURCE_NAME_, DESCRIPTION_, HAS_START_FORM_KEY_, HAS_GRAPHICAL_NOTATION_ , SUSPENSION_STATE_, TENANT_ID_) values (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
09:07:57,559 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.insertProcessDefinition  - ==> Parameters: onboarding:1:4(String), http://www.activiti.org/processdef(String), Onboarding(String), onboarding(String), 1(Integer), 1(String), onboarding.bpmn20.xml(String), onboarding.onboarding.png(String), null, false(Boolean), true(Boolean), 1(Integer), (String)
09:07:57,562 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.insertProcessDefinition  - <==    Updates: 1

ACT_RE_DEPLOYMENT插入数据

09:07:57,562 [main] DEBUG org.activiti.engine.impl.persistence.entity.DeploymentEntity.insertDeployment  - ==>  Preparing: insert into ACT_RE_DEPLOYMENT(ID_, NAME_, CATEGORY_, TENANT_ID_, DEPLOY_TIME_) values(?, ?, ?, ?, ?) 
09:07:57,567 [main] DEBUG org.activiti.engine.impl.persistence.entity.DeploymentEntity.insertDeployment  - ==> Parameters: 1(String), null, null, (String), 2018-05-06 21:07:55.458(Timestamp)
09:07:57,579 [main] DEBUG org.activiti.engine.impl.persistence.entity.DeploymentEntity.insertDeployment  - <==    Updates: 1

ACT_GE_BYTEARRAY插入数据

09:07:57,634 [main] DEBUG org.activiti.engine.impl.persistence.entity.ResourceEntity.bulkInsertResource  - ==>  Preparing: INSERT INTO ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) 
09:07:57,636 [main] DEBUG org.activiti.engine.impl.persistence.entity.ResourceEntity.bulkInsertResource  - ==> Parameters: 2(String), onboarding.bpmn20.xml(String), java.io.ByteArrayInputStream@289710d9(ByteArrayInputStream), 1(String), false(Boolean), 3(String), onboarding.onboarding.png(String), java.io.ByteArrayInputStream@5a18cd76(ByteArrayInputStream), 1(String), true(Boolean)
09:07:57,651 [main] DEBUG org.activiti.engine.impl.persistence.entity.ResourceEntity.bulkInsertResource  - <==    Updates: 2

(这是编写在测试代码中的部分)再查询一下是否部署成功,显示查到一条记录

09:07:57,688 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectProcessDefinitionsByQueryCriteria_mysql  - ==>  Preparing: select distinct RES.* from ACT_RE_PROCDEF RES WHERE RES.DEPLOYMENT_ID_ = ? order by RES.ID_ asc LIMIT ? OFFSET ? 
09:07:57,689 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectProcessDefinitionsByQueryCriteria_mysql  - ==> Parameters: 1(String), 2147483647(Integer), 0(Integer)
09:07:57,692 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectProcessDefinitionsByQueryCriteria_mysql  - <==      Total: 1

流程部署就完成了

3. 开始启动流程实例

流程部署完成后的ID是onboarding:1:4
查表

09:07:57,697 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectLatestProcessDefinitionByKey  - ==>  Preparing: select * from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null) and VERSION_ = (select max(VERSION_) from ACT_RE_PROCDEF where KEY_ = ? and (TENANT_ID_ = '' or TENANT_ID_ is null)) 
09:07:57,697 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectLatestProcessDefinitionByKey  - ==> Parameters: onboarding(String), onboarding(String)
09:07:57,700 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectLatestProcessDefinitionByKey  - <==      Total: 1
09:07:57,701 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectProcessDefinitionById  - ==>  Preparing: select * from ACT_RE_PROCDEF where ID_ = ? 
09:07:57,702 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectProcessDefinitionById  - ==> Parameters: onboarding:1:4(String)
09:07:57,704 [main] DEBUG org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.selectProcessDefinitionById  - <==      Total: 1

查表,看是否执行ID被使用

09:07:57,731 [main] DEBUG org.activiti.engine.impl.persistence.entity.JobEntity.selectJobsByExecutionId  - ==>  Preparing: select * from ACT_RU_JOB J where J.EXECUTION_ID_ = ? 
09:07:57,731 [main] DEBUG org.activiti.engine.impl.persistence.entity.JobEntity.selectJobsByExecutionId  - ==> Parameters: 5(String)
09:07:57,732 [main] DEBUG org.activiti.engine.impl.persistence.entity.JobEntity.selectJobsByExecutionId  - <==      Total: 0
09:07:57,736 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTasksByExecutionId  - ==>  Preparing: select distinct T.* from ACT_RU_TASK T where T.EXECUTION_ID_ = ? 
09:07:57,737 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTasksByExecutionId  - ==> Parameters: 5(String)
09:07:57,752 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTasksByExecutionId  - <==      Total: 0

插入数据
按照表的先后顺序是:
ACT_HI_VARINST
ACT_HI_TASKINST
ACT_HI_PROCINST
ACT_HI_ACTINST
ACT_HI_IDENTITYLINK
ACT_RU_EXECUTION
ACT_RU_TASK
ACT_RU_IDENTITYLINK
ACT_RU_VARIABLE

09:07:57,764 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricVariableInstanceEntity[id=6, name=initiator, revision=0, type=null]
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert ProcessInstance[5]
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricTaskInstanceEntity[id=9, name=Enter Data]
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert VariableInstanceEntity[id=6, name=initiator, type=null]
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricProcessInstanceEntity[superProcessInstanceId=null]
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricActivityInstanceEntity[activityId=startOnboarding, activityName=Start]
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricActivityInstanceEntity[activityId=enterOnboardingData, activityName=Enter Data]
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert Task[id=9, name=Enter Data]
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert IdentityLinkEntity[id=10, type=candidate, groupId=managers, taskId=9]
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert org.activiti.engine.impl.persistence.entity.HistoricIdentityLinkEntity@45fd9a4d
09:07:57,765 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - flush summary: 10 insert, 0 update, 0 delete.
09:07:57,766 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - now executing flush...
09:07:57,766 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - inserting: HistoricVariableInstanceEntity[id=6, name=initiator, revision=0, type=null]
09:07:57,766 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance  - ==>  Preparing: insert into ACT_HI_VARINST (ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_, CREATE_TIME_, LAST_UPDATED_TIME_) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
09:07:57,769 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance  - ==> Parameters: 6(String), 5(String), 5(String), null, initiator(String), 0(Integer), null(String), null, null, null, null, null, 2018-05-06 21:07:57.709(Timestamp), 2018-05-06 21:07:57.709(Timestamp)
09:07:57,773 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.insertHistoricVariableInstance  - <==    Updates: 1
09:07:57,773 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - inserting: HistoricTaskInstanceEntity[id=9, name=Enter Data]
09:07:57,774 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.insertHistoricTaskInstance  - ==>  Preparing: insert into ACT_HI_TASKINST ( ID_, PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, OWNER_, ASSIGNEE_, START_TIME_, CLAIM_TIME_, END_TIME_, DURATION_, DELETE_REASON_, TASK_DEF_KEY_, FORM_KEY_, PRIORITY_, DUE_DATE_, CATEGORY_, TENANT_ID_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
09:07:57,778 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.insertHistoricTaskInstance  - ==> Parameters: 9(String), onboarding:1:4(String), 5(String), 5(String), Enter Data(String), null, null, null, null, 2018-05-06 21:07:57.754(Timestamp), null, null, null, null, enterOnboardingData(String), null, 50(Integer), null, null, (String)
09:07:57,781 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.insertHistoricTaskInstance  - <==    Updates: 1
09:07:57,781 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - inserting: HistoricProcessInstanceEntity[superProcessInstanceId=null]
09:07:57,781 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.insertHistoricProcessInstance  - ==>  Preparing: insert into ACT_HI_PROCINST ( ID_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, START_TIME_, END_TIME_, DURATION_, START_USER_ID_, START_ACT_ID_, END_ACT_ID_, SUPER_PROCESS_INSTANCE_ID_, DELETE_REASON_, TENANT_ID_, NAME_ ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
09:07:57,783 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.insertHistoricProcessInstance  - ==> Parameters: 5(String), 5(String), null, onboarding:1:4(String), 2018-05-06 21:07:57.713(Timestamp), null, null, null, startOnboarding(String), null, null, null, (String), null
09:07:57,786 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.insertHistoricProcessInstance  - <==    Updates: 1
09:07:57,791 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.bulkInsertHistoricActivityInstance  - ==>  Preparing: insert into ACT_HI_ACTINST ( ID_, PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_ID_, TASK_ID_, CALL_PROC_INST_ID_, ACT_NAME_, ACT_TYPE_, ASSIGNEE_, START_TIME_, END_TIME_, DURATION_, TENANT_ID_ ) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) , (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
09:07:57,795 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.bulkInsertHistoricActivityInstance  - ==> Parameters: 7(String), onboarding:1:4(String), 5(String), 5(String), startOnboarding(String), null, null, Start(String), startEvent(String), null, 2018-05-06 21:07:57.713(Timestamp), 2018-05-06 21:07:57.734(Timestamp), 21(Long), (String), 8(String), onboarding:1:4(String), 5(String), 5(String), enterOnboardingData(String), 9(String), null, Enter Data(String), userTask(String), null, 2018-05-06 21:07:57.735(Timestamp), null, null, (String)
09:07:57,801 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.bulkInsertHistoricActivityInstance  - <==    Updates: 2
09:07:57,802 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - inserting: org.activiti.engine.impl.persistence.entity.HistoricIdentityLinkEntity@45fd9a4d
09:07:57,803 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricIdentityLinkEntity.insertHistoricIdentityLink  - ==>  Preparing: insert into ACT_HI_IDENTITYLINK (ID_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_) values (?, ?, ?, ?, ?, ?) 
09:07:57,803 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricIdentityLinkEntity.insertHistoricIdentityLink  - ==> Parameters: 10(String), candidate(String), null, managers(String), 9(String), null
09:07:57,806 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricIdentityLinkEntity.insertHistoricIdentityLink  - <==    Updates: 1
09:07:57,807 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - inserting: ProcessInstance[5]
09:07:57,807 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.insertExecution  - ==>  Preparing: insert into ACT_RU_EXECUTION (ID_, REV_, PROC_INST_ID_, BUSINESS_KEY_, PROC_DEF_ID_, ACT_ID_, IS_ACTIVE_, IS_CONCURRENT_, IS_SCOPE_,IS_EVENT_SCOPE_, PARENT_ID_, SUPER_EXEC_, SUSPENSION_STATE_, CACHED_ENT_STATE_, TENANT_ID_, NAME_) values ( ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
09:07:57,810 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.insertExecution  - ==> Parameters: 5(String), 5(String), null, onboarding:1:4(String), enterOnboardingData(String), true(Boolean), false(Boolean), true(Boolean), false(Boolean), null, null, 1(Integer), 2(Integer), (String), null
09:07:57,827 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.insertExecution  - <==    Updates: 1
09:07:57,827 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - inserting: Task[id=9, name=Enter Data]
09:07:57,828 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.insertTask  - ==>  Preparing: insert into ACT_RU_TASK (ID_, REV_, NAME_, PARENT_TASK_ID_, DESCRIPTION_, PRIORITY_, CREATE_TIME_, OWNER_, ASSIGNEE_, DELEGATION_, EXECUTION_ID_, PROC_INST_ID_, PROC_DEF_ID_, TASK_DEF_KEY_, DUE_DATE_, CATEGORY_, SUSPENSION_STATE_, TENANT_ID_, FORM_KEY_) values (?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
09:07:57,830 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.insertTask  - ==> Parameters: 9(String), Enter Data(String), null, null, 50(Integer), 2018-05-06 21:07:57.736(Timestamp), null, null, null, 5(String), 5(String), onboarding:1:4(String), enterOnboardingData(String), null, null, 1(Integer), (String), null
09:07:57,833 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.insertTask  - <==    Updates: 1
09:07:57,833 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - inserting: IdentityLinkEntity[id=10, type=candidate, groupId=managers, taskId=9]
09:07:57,833 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.insertIdentityLink  - ==>  Preparing: insert into ACT_RU_IDENTITYLINK (ID_, REV_, TYPE_, USER_ID_, GROUP_ID_, TASK_ID_, PROC_INST_ID_, PROC_DEF_ID_) values (?, 1, ?, ?, ?, ?, ?, ?) 
09:07:57,835 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.insertIdentityLink  - ==> Parameters: 10(String), candidate(String), null, managers(String), 9(String), null, null
09:07:57,847 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.insertIdentityLink  - <==    Updates: 1
09:07:57,847 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - inserting: VariableInstanceEntity[id=6, name=initiator, type=null]
09:07:57,847 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.insertVariableInstance  - ==>  Preparing: insert into ACT_RU_VARIABLE (ID_, REV_, TYPE_, NAME_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_) values ( ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
09:07:57,848 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.insertVariableInstance  - ==> Parameters: 6(String), null(String), initiator(String), 5(String), 5(String), null, null, null, null, null, null
09:07:57,861 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.insertVariableInstance  - <==    Updates: 1
09:07:57,861 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - firing event committing...
09:07:57,861 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - committing the ibatis sql session...
09:07:57,861 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Committing JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
09:07:57,864 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - firing event committed...
09:07:57,866 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Resetting autocommit to true on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
09:07:57,866 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Closing JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
09:07:57,866 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource  - Returned connection 2143431083 to pool.
09:07:57,866 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - --- StartProcessInstanceCmd finished 

流程实例到这里就启动完毕了
Onboarding process started with process instance id [5] key [onboarding]

4. 查询任务并完成任务

使用managers角色查询个人任务

ACT_RU_TASK
ACT_RU_IDENTITYLINK

09:07:57,909 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria  - ==>  Preparing: select distinct RES.* from ACT_RU_TASK RES inner join ACT_RU_IDENTITYLINK I on I.TASK_ID_ = RES.ID_ WHERE RES.ASSIGNEE_ is null and I.TYPE_ = 'candidate' and ( I.GROUP_ID_ IN ( ? ) ) order by RES.ID_ asc LIMIT ? OFFSET ? 
09:07:57,910 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria  - ==> Parameters: managers(String), 2147483647(Integer), 0(Integer)
09:07:57,914 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTaskByQueryCriteria  - <==      Total: 1

查询结果是由1个任务
当前所在的流程环节是Enter Data

Active outstanding tasks: [1]
Processing Task [Enter Data]

ACT_RU_TASK
ACT_RU_EXECUTION
ACT_RU_VARIABLE

09:07:57,920 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTask  - ==>  Preparing: select * from ACT_RU_TASK where ID_ = ? 
09:07:57,920 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTask  - ==> Parameters: 9(String)
09:07:57,925 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTask  - <==      Total: 1
09:07:57,926 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecution  - ==>  Preparing: select * from ACT_RU_EXECUTION where ID_ = ? 
09:07:57,927 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecution  - ==> Parameters: 5(String)
09:07:57,930 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecution  - <==      Total: 1
09:07:57,932 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByExecutionId  - ==>  Preparing: select * from ACT_RU_VARIABLE where EXECUTION_ID_ = ? and TASK_ID_ is null 
09:07:57,933 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByExecutionId  - ==> Parameters: 5(String)
09:07:57,936 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByExecutionId  - <==      Total: 1

获取到当前任务的流程变量之后
调用taskService.complete(task.getId(), variables);完成提交当前任务
这其中做了一系列的查询/插入/删除操作

10:23:48,580 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - --- starting CompleteTaskCmd --------------------------------------------------------
10:23:48,581 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Opening JDBC Connection
10:23:48,581 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource  - Checked out connection 2143431083 from pool.
10:23:48,581 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Setting autocommit to false on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,582 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTask  - ==>  Preparing: select * from ACT_RU_TASK where ID_ = ? 
10:23:48,582 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTask  - ==> Parameters: 9(String)
10:23:48,585 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTask  - <==      Total: 1
10:23:48,586 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecution  - ==>  Preparing: select * from ACT_RU_EXECUTION where ID_ = ? 
10:23:48,587 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecution  - ==> Parameters: 5(String)
10:23:48,590 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecution  - <==      Total: 1
10:23:48,590 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByExecutionId  - ==>  Preparing: select * from ACT_RU_VARIABLE where EXECUTION_ID_ = ? and TASK_ID_ is null 
10:23:48,591 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByExecutionId  - ==> Parameters: 5(String)
10:23:48,593 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByExecutionId  - <==      Total: 1
10:23:48,593 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,594 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: FULL
10:23:48,594 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,594 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: FULL
10:23:48,594 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTasksByParentTaskId  - ==>  Preparing: select * from ACT_RU_TASK where PARENT_TASK_ID_ = ? 
10:23:48,595 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTasksByParentTaskId  - ==> Parameters: 9(String)
10:23:48,600 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTasksByParentTaskId  - <==      Total: 0
10:23:48,603 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.selectIdentityLinksByTask  - ==>  Preparing: select * from ACT_RU_IDENTITYLINK where TASK_ID_ = ? 
10:23:48,604 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.selectIdentityLinksByTask  - ==> Parameters: 9(String)
10:23:48,606 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.selectIdentityLinksByTask  - <==      Total: 1
10:23:48,609 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByTaskId  - ==>  Preparing: select * from ACT_RU_VARIABLE where TASK_ID_ = ? 
10:23:48,609 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByTaskId  - ==> Parameters: 9(String)
10:23:48,611 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByTaskId  - <==      Total: 0
10:23:48,611 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: AUDIT
10:23:48,611 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.selectHistoricTaskInstance  - ==>  Preparing: select * from ACT_HI_TASKINST where ID_ = ? 
10:23:48,612 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.selectHistoricTaskInstance  - ==> Parameters: 9(String)
10:23:48,617 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.selectHistoricTaskInstance  - <==      Total: 1
10:23:48,622 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTasksByExecutionId  - ==>  Preparing: select distinct T.* from ACT_RU_TASK T where T.EXECUTION_ID_ = ? 
10:23:48,622 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTasksByExecutionId  - ==> Parameters: 5(String)
10:23:48,625 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.selectTasksByExecutionId  - <==      Total: 1
10:23:48,625 [main] DEBUG org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior  - Leaving activity 'enterOnboardingData'
10:23:48,625 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,630 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.selectHistoricActivityInstancesByQueryCriteria  - ==>  Preparing: select RES.* from ACT_HI_ACTINST RES WHERE RES.EXECUTION_ID_ = ? and RES.ACT_ID_ = ? and RES.END_TIME_ is null order by RES.ID_ asc LIMIT ? OFFSET ? 
10:23:48,632 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.selectHistoricActivityInstancesByQueryCriteria  - ==> Parameters: 5(String), enterOnboardingData(String), 1(Integer), 0(Integer)
10:23:48,636 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.selectHistoricActivityInstancesByQueryCriteria  - <==      Total: 1
10:23:48,637 [main] DEBUG org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake  - ProcessInstance[5] takes transition (enterOnboardingData)--sid-42BE5661-C3D5-4DE6-96F5-73D34822727A-->(decision)
10:23:48,637 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,637 [main] DEBUG org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute  - ProcessInstance[5] executes Activity(decision): org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior
10:23:48,637 [main] DEBUG org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior  - Leaving activity 'decision'
10:23:48,650 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,651 [main] DEBUG org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake  - ProcessInstance[5] takes transition (decision)--automatedIntroPath-->(automatedIntro)
10:23:48,651 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,651 [main] DEBUG org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute  - ProcessInstance[5] executes Activity(automatedIntro): org.activiti.engine.impl.bpmn.helper.ClassDelegate
10:23:48,657 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,658 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: FULL
Faux call to backend for [joy1]
10:23:48,658 [main] DEBUG org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior  - Leaving activity 'automatedIntro'
10:23:48,658 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,658 [main] DEBUG org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake  - ProcessInstance[5] takes transition (automatedIntro)--sid-37A73ACA-2E23-400B-96F3-71F77738DAFA-->(endOnboarding)
10:23:48,659 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,659 [main] DEBUG org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute  - ProcessInstance[5] executes Activity(endOnboarding): org.activiti.engine.impl.bpmn.behavior.NoneEndEventActivityBehavior
10:23:48,659 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,659 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,660 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT
10:23:48,660 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.selectHistoricProcessInstance  - ==>  Preparing: select * from ACT_HI_PROCINST where PROC_INST_ID_ = ? 
10:23:48,661 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.selectHistoricProcessInstance  - ==> Parameters: 5(String)
10:23:48,665 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.selectHistoricProcessInstance  - <==      Total: 1
10:23:48,666 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity  - destroying ProcessInstance[5]
10:23:48,666 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,666 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,666 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,667 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.selectHistoricVariableInstanceByVariableInstanceId  - ==>  Preparing: select * from ACT_HI_VARINST where ID_ = ? 
10:23:48,667 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.selectHistoricVariableInstanceByVariableInstanceId  - ==> Parameters: 6(String)
10:23:48,670 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.selectHistoricVariableInstanceByVariableInstanceId  - <==      Total: 1
10:23:48,671 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,671 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,671 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - skipping redundant delete: VariableInstanceEntity[id=11, name=yearsOfExperience, type=long, longValue=2, textValue=2]
10:23:48,671 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,671 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - skipping redundant delete: VariableInstanceEntity[id=15, name=autoWelcomeTime, type=date, longValue=1525616628657]
10:23:48,671 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,671 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - skipping redundant delete: VariableInstanceEntity[id=6, name=initiator, type=null]
10:23:48,671 [main] DEBUG org.activiti.engine.impl.history.DefaultHistoryManager  - Current history level: AUDIT, level required: ACTIVITY
10:23:48,671 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - skipping redundant delete: VariableInstanceEntity[id=12, name=fullName, type=string, textValue=joy1]
10:23:48,672 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecutionsByParentExecutionId  - ==>  Preparing: select * from ACT_RU_EXECUTION where PARENT_ID_ = ? 
10:23:48,672 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecutionsByParentExecutionId  - ==> Parameters: 5(String)
10:23:48,673 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectExecutionsByParentExecutionId  - <==      Total: 0
10:23:48,674 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.selectIdentityLinksByProcessInstance  - ==>  Preparing: select * from ACT_RU_IDENTITYLINK where PROC_INST_ID_ = ? 
10:23:48,674 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.selectIdentityLinksByProcessInstance  - ==> Parameters: 5(String)
10:23:48,675 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.selectIdentityLinksByProcessInstance  - <==      Total: 0
10:23:48,676 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricVariableInstanceEntity[id=11, name=yearsOfExperience, revision=0, type=long, longValue=2, textValue=2]
10:23:48,676 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricVariableInstanceEntity[id=12, name=fullName, revision=0, type=string, textValue=joy1]
10:23:48,676 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricVariableInstanceEntity[id=15, name=autoWelcomeTime, revision=0, type=date, longValue=1525616628657]
10:23:48,676 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricActivityInstanceEntity[activityId=decision, activityName=Years of Experience]
10:23:48,676 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricActivityInstanceEntity[activityId=automatedIntro, activityName=Generic and Automated Data Entry]
10:23:48,676 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   insert HistoricActivityInstanceEntity[activityId=endOnboarding, activityName=End]
10:23:48,676 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   update HistoricVariableInstanceEntity[id=6, name=initiator, revision=0, type=null]
10:23:48,677 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   update HistoricTaskInstanceEntity[id=9, name=Enter Data]
10:23:48,677 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   update HistoricActivityInstanceEntity[activityId=enterOnboardingData, activityName=Enter Data]
10:23:48,677 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   update HistoricProcessInstanceEntity[superProcessInstanceId=null]
10:23:48,677 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   delete IdentityLinkEntity[id=10, type=candidate, groupId=managers, taskId=9]
10:23:48,677 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   delete Task[id=9, name=Enter Data]
10:23:48,677 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   delete VariableInstanceEntity[id=6, name=initiator, type=null]
10:23:48,677 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  -   delete ProcessInstance[5]
10:23:48,677 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - flush summary: 6 insert, 4 update, 4 delete.
10:23:48,677 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - now executing flush...
10:23:48,683 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.bulkInsertHistoricVariableInstance  - ==>  Preparing: insert into ACT_HI_VARINST (ID_, PROC_INST_ID_, EXECUTION_ID_, TASK_ID_, NAME_, REV_, VAR_TYPE_, BYTEARRAY_ID_, DOUBLE_, LONG_ , TEXT_, TEXT2_, CREATE_TIME_, LAST_UPDATED_TIME_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) , (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) , (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
10:23:48,690 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.bulkInsertHistoricVariableInstance  - ==> Parameters: 11(String), 5(String), 5(String), null, yearsOfExperience(String), 0(Integer), long(String), null, null, 2(Long), 2(String), null, 2018-05-06 22:23:48.594(Timestamp), 2018-05-06 22:23:48.671(Timestamp), 12(String), 5(String), 5(String), null, fullName(String), 0(Integer), string(String), null, null, null, joy1(String), null, 2018-05-06 22:23:48.594(Timestamp), 2018-05-06 22:23:48.671(Timestamp), 15(String), 5(String), 5(String), null, autoWelcomeTime(String), 0(Integer), date(String), null, null, 1525616628657(Long), null, null, 2018-05-06 22:23:48.658(Timestamp), 2018-05-06 22:23:48.671(Timestamp)
10:23:48,693 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.bulkInsertHistoricVariableInstance  - <==    Updates: 3
10:23:48,699 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.bulkInsertHistoricActivityInstance  - ==>  Preparing: insert into ACT_HI_ACTINST ( ID_, PROC_DEF_ID_, PROC_INST_ID_, EXECUTION_ID_, ACT_ID_, TASK_ID_, CALL_PROC_INST_ID_, ACT_NAME_, ACT_TYPE_, ASSIGNEE_, START_TIME_, END_TIME_, DURATION_, TENANT_ID_ ) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) , (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) , (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 
10:23:48,706 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.bulkInsertHistoricActivityInstance  - ==> Parameters: 13(String), onboarding:1:4(String), 5(String), 5(String), decision(String), null, null, Years of Experience(String), exclusiveGateway(String), null, 2018-05-06 22:23:48.637(Timestamp), 2018-05-06 22:23:48.651(Timestamp), 14(Long), (String), 14(String), onboarding:1:4(String), 5(String), 5(String), automatedIntro(String), null, null, Generic and Automated Data Entry(String), serviceTask(String), null, 2018-05-06 22:23:48.651(Timestamp), 2018-05-06 22:23:48.658(Timestamp), 7(Long), (String), 16(String), onboarding:1:4(String), 5(String), 5(String), endOnboarding(String), null, null, End(String), endEvent(String), null, 2018-05-06 22:23:48.659(Timestamp), 2018-05-06 22:23:48.659(Timestamp), 0(Long), (String)
10:23:48,708 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.bulkInsertHistoricActivityInstance  - <==    Updates: 3
10:23:48,708 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - updating: HistoricVariableInstanceEntity[id=6, name=initiator, revision=0, type=null]
10:23:48,711 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.updateHistoricVariableInstance  - ==>  Preparing: update ACT_HI_VARINST set REV_ = ?, BYTEARRAY_ID_ = ?, DOUBLE_ = ?, LONG_ = ?, TEXT_ = ?, TEXT2_ = ?, VAR_TYPE_ = ?, LAST_UPDATED_TIME_ = ? where ID_ = ? and REV_ = ? 
10:23:48,713 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.updateHistoricVariableInstance  - ==> Parameters: 1(Integer), null, null, null, null, null, null(String), 2018-05-06 22:23:48.671(Timestamp), 6(String), 0(Integer)
10:23:48,714 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.updateHistoricVariableInstance  - <==    Updates: 1
10:23:48,716 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - updating: HistoricTaskInstanceEntity[id=9, name=Enter Data]
10:23:48,716 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.updateHistoricTaskInstance  - ==>  Preparing: update ACT_HI_TASKINST set PROC_DEF_ID_ = ?, EXECUTION_ID_ = ?, NAME_ = ?, PARENT_TASK_ID_ = ?, DESCRIPTION_ = ?, OWNER_ = ?, ASSIGNEE_ = ?, CLAIM_TIME_ = ?, END_TIME_ = ?, DURATION_ = ?, DELETE_REASON_ = ?, TASK_DEF_KEY_ = ?, FORM_KEY_ = ?, PRIORITY_ = ?, DUE_DATE_ = ?, CATEGORY_ = ? where ID_ = ? 
10:23:48,717 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.updateHistoricTaskInstance  - ==> Parameters: onboarding:1:4(String), 5(String), Enter Data(String), null, null, null, null, null, 2018-05-06 22:23:48.621(Timestamp), 9675(Long), completed(String), enterOnboardingData(String), null, 50(Integer), null, null, 9(String)
10:23:48,719 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.updateHistoricTaskInstance  - <==    Updates: 1
10:23:48,719 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - updating: HistoricActivityInstanceEntity[activityId=enterOnboardingData, activityName=Enter Data]
10:23:48,719 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.updateHistoricActivityInstance  - ==>  Preparing: update ACT_HI_ACTINST set EXECUTION_ID_ = ?, ASSIGNEE_ = ?, END_TIME_ = ?, DURATION_ = ? where ID_ = ? 
10:23:48,720 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.updateHistoricActivityInstance  - ==> Parameters: 5(String), null, 2018-05-06 22:23:48.637(Timestamp), 9701(Long), 8(String)
10:23:48,722 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.updateHistoricActivityInstance  - <==    Updates: 1
10:23:48,722 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - updating: HistoricProcessInstanceEntity[superProcessInstanceId=null]
10:23:48,722 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.updateHistoricProcessInstance  - ==>  Preparing: update ACT_HI_PROCINST set PROC_DEF_ID_ = ?, BUSINESS_KEY_ = ?, START_TIME_ = ?, END_TIME_ = ?, DURATION_ = ?, END_ACT_ID_ = ?, DELETE_REASON_ = ?, NAME_ = ? where ID_ = ? 
10:23:48,724 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.updateHistoricProcessInstance  - ==> Parameters: onboarding:1:4(String), null, 2018-05-06 22:23:38.922(Timestamp), 2018-05-06 22:23:48.665(Timestamp), 9743(Long), endOnboarding(String), null, null, 5(String)
10:23:48,725 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.updateHistoricProcessInstance  - <==    Updates: 1
10:23:48,725 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - executing: delete IdentityLinkEntity[id=10, type=candidate, groupId=managers, taskId=9]
10:23:48,726 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.deleteIdentityLink  - ==>  Preparing: delete from ACT_RU_IDENTITYLINK where ID_ = ? 
10:23:48,726 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.deleteIdentityLink  - ==> Parameters: 10(String)
10:23:48,728 [main] DEBUG org.activiti.engine.impl.persistence.entity.IdentityLinkEntity.deleteIdentityLink  - <==    Updates: 1
10:23:48,728 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - executing: delete Task[id=9, name=Enter Data]
10:23:48,728 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.deleteTask  - ==>  Preparing: delete from ACT_RU_TASK where ID_ = ? and REV_ = ? 
10:23:48,729 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.deleteTask  - ==> Parameters: 9(String), 1(Integer)
10:23:48,738 [main] DEBUG org.activiti.engine.impl.persistence.entity.TaskEntity.deleteTask  - <==    Updates: 1
10:23:48,739 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - executing: delete VariableInstanceEntity[id=6, name=initiator, type=null]
10:23:48,739 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.deleteVariableInstance  - ==>  Preparing: delete from ACT_RU_VARIABLE where ID_ = ? and REV_ = ? 
10:23:48,739 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.deleteVariableInstance  - ==> Parameters: 6(String), 1(Integer)
10:23:48,741 [main] DEBUG org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.deleteVariableInstance  - <==    Updates: 1
10:23:48,742 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - executing: delete ProcessInstance[5]
10:23:48,742 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution  - ==>  Preparing: delete from ACT_RU_EXECUTION where ID_ = ? and REV_ = ? 
10:23:48,743 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution  - ==> Parameters: 5(String), 1(Integer)
10:23:48,752 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.deleteExecution  - <==    Updates: 1
10:23:48,753 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - firing event committing...
10:23:48,753 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - committing the ibatis sql session...
10:23:48,753 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Committing JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,756 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - firing event committed...
10:23:48,756 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Resetting autocommit to true on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,757 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Closing JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,757 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource  - Returned connection 2143431083 to pool.
10:23:48,758 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - --- CompleteTaskCmd finished --------------------------------------------------------
10:23:48,758 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - 

到这里,任务根据配置,是直接执行到了结束节点

5. 查询历史

这一段是写在测试代码的,作为演示而已

输出历史任务
10:23:48,759 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - 

10:23:48,759 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - --- starting HistoricActivityInstanceQueryImpl --------------------------------------------------------
10:23:48,760 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Opening JDBC Connection
10:23:48,760 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource  - Checked out connection 2143431083 from pool.
10:23:48,760 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Setting autocommit to false on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,762 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.selectHistoricActivityInstancesByQueryCriteria  - ==>  Preparing: select RES.* from ACT_HI_ACTINST RES WHERE RES.PROC_INST_ID_ = ? and RES.END_TIME_ is not null order by END_TIME_ asc LIMIT ? OFFSET ? 
10:23:48,765 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.selectHistoricActivityInstancesByQueryCriteria  - ==> Parameters: 5(String), 2147483647(Integer), 0(Integer)
10:23:48,770 [main] DEBUG org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.selectHistoricActivityInstancesByQueryCriteria  - <==      Total: 5
10:23:48,771 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - flush summary: 0 insert, 0 update, 0 delete.
10:23:48,771 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - now executing flush...
10:23:48,771 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - firing event committing...
10:23:48,771 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - committing the ibatis sql session...
10:23:48,771 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - firing event committed...
10:23:48,771 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Resetting autocommit to true on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,772 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Closing JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,772 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource  - Returned connection 2143431083 to pool.
10:23:48,772 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - --- HistoricActivityInstanceQueryImpl finished --------------------------------------------------------
10:23:48,772 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - 

-- Start [startOnboarding] 14 ms
-- Enter Data [enterOnboardingData] 9701 ms
-- Years of Experience [decision] 14 ms
-- Generic and Automated Data Entry [automatedIntro] 7 ms
-- End [endOnboarding] 0 ms
10:23:48,772 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - 

10:23:48,773 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - --- starting ProcessInstanceQueryImpl --------------------------------------------------------
10:23:48,787 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Opening JDBC Connection
10:23:48,787 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource  - Checked out connection 2143431083 from pool.
10:23:48,787 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Setting autocommit to false on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,787 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectProcessInstanceByQueryCriteria  - ==>  Preparing: select distinct RES.* , P.KEY_ as ProcessDefinitionKey, P.ID_ as ProcessDefinitionId, P.NAME_ as ProcessDefinitionName, P.VERSION_ as ProcessDefinitionVersion, P.DEPLOYMENT_ID_ as DeploymentId from ACT_RU_EXECUTION RES inner join ACT_RE_PROCDEF P on RES.PROC_DEF_ID_ = P.ID_ WHERE RES.PARENT_ID_ is null and RES.ID_ = ? and RES.PROC_INST_ID_ = ? order by RES.ID_ asc LIMIT ? OFFSET ? 
10:23:48,788 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectProcessInstanceByQueryCriteria  - ==> Parameters: 5(String), 5(String), 2147483647(Integer), 0(Integer)
10:23:48,790 [main] DEBUG org.activiti.engine.impl.persistence.entity.ExecutionEntity.selectProcessInstanceByQueryCriteria  - <==      Total: 0
10:23:48,790 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - flush summary: 0 insert, 0 update, 0 delete.
10:23:48,790 [main] DEBUG org.activiti.engine.impl.db.DbSqlSession  - now executing flush...
10:23:48,790 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - firing event committing...
10:23:48,790 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - committing the ibatis sql session...
10:23:48,790 [main] DEBUG org.activiti.engine.impl.cfg.standalone.StandaloneMybatisTransactionContext  - firing event committed...
10:23:48,791 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Resetting autocommit to true on JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,792 [main] DEBUG org.apache.ibatis.transaction.jdbc.JdbcTransaction  - Closing JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@7fc229ab]
10:23:48,792 [main] DEBUG org.apache.ibatis.datasource.pooled.PooledDataSource  - Returned connection 2143431083 to pool.
10:23:48,792 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - --- ProcessInstanceQueryImpl finished --------------------------------------------------------
10:23:48,792 [main] DEBUG org.activiti.engine.impl.interceptor.LogInterceptor  - 

同理可以分析第二次运行的debug日志

你可能感兴趣的:(Activiti)