Java教程

flowable测试demo

本文主要是介绍flowable测试demo,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

要构建的流程是一个非常简单的请假流程。Flowable引擎需要流程定义为BPMN 2.0格式,这是一个业界广泛接受的XML标准。

在Flowable术语中,我们将其称为一个流程定义(process definition)。一个流程定义可以启动多个流程实例(process instance)。流程定义可以看做是重复执行流程的蓝图。 在这个例子中,流程定义定义了请假的各个步骤,而一个流程实例对应某个雇员提出的一个请假申请。

BPMN 2.0存储为XML,并包含可视化的部分:使用标准方式定义了每个步骤类型(人工任务,自动服务调用,等等)如何呈现,以及如何互相连接。这样BPMN 2.0标准使技术人员与业务人员能用双方都能理解的方式交流业务流程。

我们要使用的流程定义为:

 

 

创建一个类,并运行一下:

package com.yuanbb.utils;

import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration;

/**
 * @Author 三分恶
 * @Date 2020/5/2
 * @Description 创建表格
 */
public class HolidayRequest {
    public static void main(String[] args) {
        //1、创建ProcessEngineConfiguration实例,该实例可以配置与调整流程引擎的设置
        ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration()
                //2、通常采用xml配置文件创建ProcessEngineConfiguration,这里直接采用代码的方式
                //3、配置数据库相关参数
                .setJdbcUrl("jdbc:mysql://localhost:3306/flowable_demo?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2b8&nullCatalogMeansCurrent=true")
                .setJdbcUsername("root")
                .setJdbcPassword("root")
                .setJdbcDriver("com.mysql.jdbc.Driver")
                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
        //4、初始化ProcessEngine流程引擎实例
        ProcessEngine processEngine = cfg.buildProcessEngine();
    }
}

  

未配置日志:

"C:\Program Files\Java\jdk1.8.0_271\bin\java.exe" "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2020.2.4\lib\idea_rt.jar=1996:D:\Program Files\JetBrains\IntelliJ IDEA 2020.2.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\java\jdk1.8.0_271\jre\lib\charsets.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\deploy.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\access-bridge-64.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\cldrdata.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\dnsns.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\jaccess.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\jfxrt.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\localedata.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\nashorn.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\sunec.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\sunjce_provider.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\sunmscapi.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\sunpkcs11.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\ext\zipfs.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\javaws.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\jce.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\jfr.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\jfxswt.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\jsse.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\management-agent.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\plugin.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\resources.jar;C:\Program Files\java\jdk1.8.0_271\jre\lib\rt.jar;D:\workspace\Gitee\White-Jotter-master\holiday-request\target\classes;C:\Users\13616\.m2\repository\org\flowable\flowable-engine\6.3.0\flowable-engine-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-bpmn-converter\6.3.0\flowable-bpmn-converter-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-bpmn-model\6.3.0\flowable-bpmn-model-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-process-validation\6.3.0\flowable-process-validation-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-image-generator\6.3.0\flowable-image-generator-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-engine-common-api\6.3.0\flowable-engine-common-api-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-engine-common\6.3.0\flowable-engine-common-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-variable-service-api\6.3.0\flowable-variable-service-api-6.3.0.jar;C:\Users\13616\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.11\jackson-core-2.8.11.jar;C:\Users\13616\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.11.1\jackson-databind-2.8.11.1.jar;C:\Users\13616\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-variable-service\6.3.0\flowable-variable-service-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-identitylink-service\6.3.0\flowable-identitylink-service-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-identitylink-service-api\6.3.0\flowable-identitylink-service-api-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-task-service\6.3.0\flowable-task-service-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-task-service-api\6.3.0\flowable-task-service-api-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-job-service\6.3.0\flowable-job-service-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-job-service-api\6.3.0\flowable-job-service-api-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-idm-api\6.3.0\flowable-idm-api-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-idm-engine\6.3.0\flowable-idm-engine-6.3.0.jar;C:\Users\13616\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\13616\.m2\repository\com\fasterxml\uuid\java-uuid-generator\3.1.3\java-uuid-generator-3.1.3.jar;C:\Users\13616\.m2\repository\log4j\log4j\1.2.13\log4j-1.2.13.jar;C:\Users\13616\.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-cmmn-api\6.3.0\flowable-cmmn-api-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-cmmn-model\6.3.0\flowable-cmmn-model-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-dmn-api\6.3.0\flowable-dmn-api-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-dmn-model\6.3.0\flowable-dmn-model-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-form-model\6.3.0\flowable-form-model-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-form-api\6.3.0\flowable-form-api-6.3.0.jar;C:\Users\13616\.m2\repository\org\flowable\flowable-content-api\6.3.0\flowable-content-api-6.3.0.jar;C:\Users\13616\.m2\repository\org\apache\commons\commons-email\1.5\commons-email-1.5.jar;C:\Users\13616\.m2\repository\com\sun\mail\javax.mail\1.5.6\javax.mail-1.5.6.jar;C:\Users\13616\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Users\13616\.m2\repository\org\apache\commons\commons-lang3\3.7\commons-lang3-3.7.jar;C:\Users\13616\.m2\repository\org\mybatis\mybatis\3.4.5\mybatis-3.4.5.jar;C:\Users\13616\.m2\repository\org\springframework\spring-beans\4.3.14.RELEASE\spring-beans-4.3.14.RELEASE.jar;C:\Users\13616\.m2\repository\org\springframework\spring-core\4.3.14.RELEASE\spring-core-4.3.14.RELEASE.jar;C:\Users\13616\.m2\repository\joda-time\joda-time\2.9.9\joda-time-2.9.9.jar;C:\Users\13616\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\13616\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Users\13616\.m2\repository\mysql\mysql-connector-java\8.0.15\mysql-connector-java-8.0.15.jar;C:\Users\13616\.m2\repository\com\google\protobuf\protobuf-java\3.6.1\protobuf-java-3.6.1.jar" com.yuanbb.utils.HolidayRequest
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

Process finished with exit code 0

  

这篇关于flowable测试demo的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!