JBPM工作流(六)——流程变量
1.启动流程实例
|
1
2
3
4
5
6
7
|
// 启动流程实例@Testpublic void startProcessInstance() { // 使用指定key的最新版本的流程定义启动流程实例 ProcessInstance pi = processEngine.getExecutionService().startProcessInstanceByKey("test"); System.out.println("processInstanceId=" + pi.getId());} |
2.设置流程变量
a) 一个设置流程变量实例
12345678910//设置流程变量@TestpublicvoidsetVariable() {String executionId ="test.140001";String name ="请假天数";Integer value =3;//将name为"请假天数",value=3的流程变量设置到executionId为test.140001的执行对象上processEngine.getExecutionService().setVariable(executionId, name, value);}b) 所有设置流程变量方法
用到变量的类型:
12345678Object value ="";String executionId ="";String taskId ="";String name ="";String processDefinitionKey ="";String variableName ="";Set<String> variableNames =newHashSet<String>();Map<String, Object> variablesMap =newHashMap<String, Object>();具体方法:
123456789101112// 根据Execution设置一个流程变量processEngine.getExecutionService().setVariable(executionId, name, value);// 根据Execution设置多个流程变量(需要先把流程变量放到一个Map中)processEngine.getExecutionService().setVariables(executionId, variablesMap);// 根据Task设置多个流程变量(需要先把流程变量放到一个Map中,通过Task方法,它会先找到它所属的Execution然后设置流程变量)processEngine.getTaskService().setVariables(taskId, variablesMap);// 使用指定key的最新版本的流程定义启动流程实例,并设置一些流程变量processEngine.getExecutionService().startProcessInstanceByKey(processDefinitionKey, variablesMap);// 办理完指定的任务,并设置一些流程变量processEngine.getTaskService().completeTask(taskId, variablesMap);
3.获取流程变量
a) 一个获取流程变量实例
12345678910//获取流程变量@TestpublicvoidgetVariable() {String executionId ="test.140001";String variableName ="请假天数";//从executionId为test.140001的执行对象上取出流程变量名为"请假天数"的流程变量的valueInteger value = (Integer) processEngine.getExecutionService().getVariable(executionId, variableName);System.out.println(variableName +" = "+ value);}
b) 所有获取流程变量方法
用到变量的类型:
1234String executionId ="";String taskId ="";String variableName ="";Set<String> variableNames =newHashSet<String>();具体方法:
12345678910111213// 根据Execution获取指定名称的一个流程变量processEngine.getExecutionService().getVariable(executionId, variableName);// 根据Execution获取所有流程变量的名称processEngine.getExecutionService().getVariableNames(executionId);// 根据Execution获取指定名称的所有流程变量processEngine.getExecutionService().getVariables(executionId, variableNames);// 根据Task获取指定名称的一个流程变量processEngine.getTaskService().getVariable(taskId, variableName);// 根据Task获取所有流程变量的名称processEngine.getTaskService().getVariableNames(taskId);// 根据Task获取指定名称的所有流程变量processEngine.getTaskService().getVariables(taskId, variableNames);
4.流程变量所支持的值的类型(jBPM User Guide,7.2. Variable types)
jBPM supports following Java types as process variables:
- java.lang.String
- java.lang.Long
- java.lang.Double
- java.util.Date
- java.lang.Boolean
- java.lang.Character
- java.lang.Byte
- java.lang.Short
- java.lang.Integer
- java.lang.Float
- byte[] (byte array)
- char[] (char array)
- hibernate entity with a long id
- hibernate entity with a string id
- serializable
For persistence of these variable, the type of the variable is checked in the order of this list. The first match will determine how the variable is stored.
JBPM工作流(六)——流程变量的更多相关文章
- 工作流Activiti5流程变量 任务变量 setVariables 跟 setVariablesLocal区别
工作流Activiti5流程变量 任务变量 setVariables 和 setVariablesLocal区别 因为网上的资料比较少.结合源码把相关API写下来. 设置流程级别变量: runtime ...
- 工作流JBPM_day01:7-使用流程变量
工作流JBPM_day01:7-使用流程变量 工作流就像流水线 对应数据库中的一张表 ProcessVariableTest.Java import java.util.List; import or ...
- 工作流学习——Activiti流程变量五步曲 (zhuan)
http://blog.csdn.net/zwk626542417/article/details/46648139 ***************************************** ...
- JBPM学习(五):流程变量
1.启动流程实例 // 启动流程实例 @Test public void startProcessInstance() { // 使用指定key的最新版本的流程定义启动流程实例 ProcessInst ...
- JBPM工作流(五)——执行流程实例
概念: ProcessInstance,流程实例:代表流程定义的一次执行.如:张三昨天按请假流程请了一次假.一个流程实例包括了所有运行阶段,其中最典型的属性就是跟踪当前节点的指针,如下图. Execu ...
- 工作流学习——Activiti流程变量五步曲
一.前言 上一篇文章我们将流程实例的启动与查询,任务的办理查询都进行了介绍,我们这篇文章来介绍activiti中的流程变量. 二.正文 流程变量与我们寻常理解的变量是一样的,仅仅只是是用在了我们act ...
- Activiti工作流(三)——流程变量
流程变量可以是流程中一系列参数,比如办理人(Assignee),消息(message)等.这些流程变量使得activiti能够应用于更为复杂的业务中,使得流程变得更加灵活可控. 场景(一) 图一:没有 ...
- JBPM工作流
一.开发环境的搭建 1.下载Jbpm4.4 1.1下载地址: https://sourceforge.net/projects/jbpm/files/jBPM%204/jbpm-4.4/ 1.2解压后 ...
- 【Java EE 学习 67 下】【OA项目练习】【SSH整合JBPM工作流】【JBPM项目实战】
一.SSH整合JBPM JBPM基础见http://www.cnblogs.com/kuangdaoyizhimei/p/4981551.html 现在将要实现SSH和JBPM的整合. 1.添加jar ...
随机推荐
- 如何在MyBatis中优雅的使用枚举
问题 在编码过程中,经常会遇到用某个数值来表示某种状态.类型或者阶段的情况,比如有这样一个枚举: public enum ComputerState { OPEN(10), //开启 CLOSE( ...
- ARM 技术文档
1. 相关链接 ARM官网: http://infocenter.arm.com/ 比较有用的几个目录: ARM Technical Support Knowledge Articles 一些关于A ...
- 前端工程化系列[04]-Grunt构建工具的使用进阶
在前端工程化系列[02]-Grunt构建工具的基本使用和前端工程化系列[03]-Grunt构建工具的运转机制这两篇文章中,我们对Grunt以及Grunt插件的使用已经有了初步的认识,并探讨了Grunt ...
- C# Task WhenAny和WhenAll 以及TaskFactory 的ContinueWhenAny和ContinueWhenAll的实现
个人感觉Task 的WaitAny和WhenAny以及TaskFactory 的ContinueWhenAny有相似的地方,而WaitAll和WhenAll以及TaskFactory 的Continu ...
- Deep Learning.ai学习笔记_第四门课_卷积神经网络
目录 第一周 卷积神经网络基础 第二周 深度卷积网络:实例探究 第三周 目标检测 第四周 特殊应用:人脸识别和神经风格转换 第一周 卷积神经网络基础 垂直边缘检测器,通过卷积计算,可以把多维矩阵进行降 ...
- Android BLE蓝牙详细解读
代码地址如下:http://www.demodashi.com/demo/15062.html 随着物联网时代的到来,越来越多的智能硬件设备开始流行起来,比如智能手环.心率检测仪.以及各式各样的智能家 ...
- android mat 转 bitmap
Bitmap bmp = null; Mat tmp = new Mat (height, width, CvType.CV_8U, new Scalar(4)); try { //Imgproc.c ...
- Java 设计模式专栏
Java 设计模式之工厂模式学习心得 转:Java 设计模式之单例模式 转: Java设计模式之建造者模式 转:Java设计模式之代理模式
- 在interface vlan下敲no ip proxy-arp什么意思
取消由路由带来的ARP请求. proxy ARP有哪些优点? 最主要的一个优点就是能够在不影响其他router的路由表的情况下在网络上添加一个新的router,这样使得子网的变化对主机是透明的 pro ...
- PON
PON(Passive Optical Network:无源光纤网络). PON(无源光网络)是指(光配线网中)不含有任何电子器件及电子电源,ODN全部由光分路器(Splitter)等无源器件组成,不 ...