flowable入门

flowable入门在使用flowable框架的时候,首先需要引入flowable的jar包,flowablemaven仓库地址为:  org.flowable  flowable-engine  6.0.0.RC1新建flowable.cfg.xml文件,如下图所示:flowable.cfg.xml文件内容如下所示:

大家好,又见面了,我是你们的朋友全栈君。

在使用
flowable框架的时候,首先需要引入
flowable的jar包,flowable maven仓库地址为:

<!– https://mvnrepository.com/artifact/org.flowable/flowable-engine –>
<dependency>
    <groupId>org.flowable</groupId>
    <artifactId>flowable-engine</artifactId>
    <version>6.0.0.RC1</version>
</dependency>

新建flowable.cfg.xml文件,如下图所示:

flowable入门

flowable.cfg.xml文件内容如下所示:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   
       http://www.springframework.org/schema/beans/spring-beans.xsd">
       <!--分享牛http://www.shareniu.com/ -->
 <bean id="dataSource"  class="com.alibaba.druid.pool.DruidDataSource">
		<property name="driverClassName">
			<value>com.mysql.jdbc.Driver</value>
		</property>
		<property name="url">
			<value>jdbc:mysql://127.0.0.1:3306/shareniuflowable?useUnicode=true&characterEncoding=UTF-8
			</value>
		</property>
		<property name="username">
			<value>root</value>
		</property>
		<property name="password" value="" />
		<!--  -->
	</bean>
	<!--分享牛http://www.shareniu.com/ -->
        <bean id="processEngineConfiguration"
          class="org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration" >  
        <property name="dataSource" ref="dataSource" />  
         <property name="databaseSchemaUpdate" value="true" />  
        </bean>  
</beans>

新建测试类如下所示:

package com.shareniu.flowables.ch1;

import java.io.IOException;
import java.io.InputStream;

import org.flowable.engine.IdentityService;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.DeploymentBuilder;
import org.junit.Before;
import org.junit.Test;

/**
 * 分享牛http://www.shareniu.com/ 
 *
 */
public class App 
{
	// 获取到Activiti ProcessEngine
		ProcessEngine processEngine = null;
		// 获取RepositoryService 实例对象
		RepositoryService repositoryService = null;
		// 资源名称
		String resourceName = "shareniu_addInputStream.bpmn";
		IdentityService identityService;
		RuntimeService runtimeService;
		TaskService taskService;
		@Before
		public void init() {
			InputStream in = App.class.getClassLoader().getResourceAsStream(
					"com/shareniu/flowables/ch1/flowable.cfg.xml");
			ProcessEngineConfiguration pcf = ProcessEngineConfiguration
					.createProcessEngineConfigurationFromInputStream(in);
			processEngine = pcf.buildProcessEngine();
			repositoryService = processEngine.getRepositoryService();
			identityService = processEngine.getIdentityService();
			runtimeService = processEngine.getRuntimeService();
			taskService = processEngine.getTaskService();
			ProcessEngineConfigurationImpl pc = (ProcessEngineConfigurationImpl) processEngine
					.getProcessEngineConfiguration();
		}
		@Test
		public void addInputStreamTest() throws IOException {
			// 定义的文件信息的流读取 分享牛http://www.shareniu.com/ 
			InputStream inputStream = App.class
					.getClassLoader().getResource("com/shareniu/flowables/ch1/common.bpmn").openStream();
			// 流程定义的分类 分享牛http://www.shareniu.com/ 
			String category = "shareniu_addInputStream";
			// 构造DeploymentBuilder对象
			DeploymentBuilder deploymentBuilder = repositoryService
					.createDeployment().category(category)
					.addInputStream(resourceName, inputStream);
			// 部署
			Deployment deploy = deploymentBuilder.deploy();
			System.out.println(deploy);

		}
		
}

运行上述代码,流程文档以及成功部署。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/143366.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • hash算法和hash一致性_分布式一致性hash

    hash算法和hash一致性_分布式一致性hash一致性哈希算法(ConsistentHashing)最早在论文《ConsistentHashingandRandomTrees:DistributedCachingProtocolsforRelievingHotSpotsontheWorldWideWeb》中被提出。简单来说,一致性哈希将整个哈希值空间组织成一个虚拟的圆环,如假设某哈希函数H的值空间为0-2^

    2022年10月5日
    0
  • 0-1多重背包(单调队列+多重背包)[通俗易懂]

    0-1多重背包(单调队列+多重背包)[通俗易懂]原题链接有 N 种物品和一个容量是 V 的背包。第 i 种物品最多有 si 件,每件体积是 vi,价值是 wi。求解将哪些物品装入背包,可使物品体积总和不超过背包容量,且价值总和最大。输出最大价值。输入格式第一行两个整数,N,V (0<N≤1000, 0<V≤20000),用空格隔开,分别表示物品种数和背包容积。接下来有 N 行,每行三个整数 vi,wi,si,用空格隔开,分别表示第 i 种物品的体积、价值和数量。输出格式输出一个整数,表示最大价值。数据范围0<N≤1

    2022年8月8日
    4
  • LTE通讯相关2:频带、信道带宽和频点号EARFCN「建议收藏」

    LTE通讯相关2:频带、信道带宽和频点号EARFCN「建议收藏」版权声明:本文为博主原创文章,遵循CC4.0BY-SA版权协议,转载请附上原文出处链接和本声明。…

    2022年10月7日
    0
  • serdes知识详解_discussed是什么意思

    serdes知识详解_discussed是什么意思理解SerDesFPGA发展到今天,SerDes(Serializer-Deserializer)基本上是标配了。从PCI到PCIExpress,从ATA到SATA,从并行ADC接口到JESD204,从RIO到SerialRIO,…等等,都是在借助SerDes来提高性能。SerDes是非常复杂的数模混合设计,用户手册的内容只是描述了森林里面的一棵小树,并不能够解释SerDes是怎么工作

    2022年10月23日
    0
  • 快速入门UML时序图「建议收藏」

    快速入门UML时序图「建议收藏」使用UML时序图重构代码使用UML时序图时序图是什么时序图的元素组合块(CombinedFragment)举例使用UML时序图最近,在重构项目中的老代码的时候,业务复杂,文档缺失。抽丝剥茧,沉迷在剪不断理还乱的纷繁的关系中,像是苏东坡诗中的那只高贵的乌鸦先生找不到落脚之处。披沙拣金,终于理出一点头绪,生怕忘了,赶紧记下来,又苦于没有好的方式去表达这些错杂的关系,蓦然发现,UML时序图是表达业…

    2022年6月29日
    34
  • 矩阵范数计算

    矩阵范数计算

    2022年6月28日
    28

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号