(九)Activitivi5之使用 RuntimeService 设置和获取流程变量
一、案例
/**
* 设置流程变量数据
*/
@Test
public void setVariableValues(){
RuntimeService runtimeService=processEngine.getRuntimeService(); // 任务Service
String executionId="90001";
runtimeService.setVariable(executionId, "days", 2);
runtimeService.setVariable(executionId, "date", new Date());
runtimeService.setVariable(executionId, "reason", "发烧");
Student student=new Student();
student.setId(1);
student.setName("张三");
runtimeService.setVariable(executionId, "student", student); // 存序列化对象
} /**
* 获取流程变量数据
*/
@Test
public void getVariableValues(){
RuntimeService runtimeService=processEngine.getRuntimeService(); // 任务Service
String executionId="102501";
Integer days=(Integer) runtimeService.getVariable(executionId, "days");
Date date=(Date) runtimeService.getVariable(executionId, "date");
String reason=(String) runtimeService.getVariable(executionId, "reason");
Student student=(Student) runtimeService.getVariable(executionId, "student");
System.out.println("请假天数:"+days);
System.out.println("请假日期:"+date);
System.out.println("请假原因:"+reason);
System.out.println("请假对象:"+student.getId()+","+student.getName());
}
- 用RuntimeService 设置/获取变量的方法跟(八)Activiti之流程变量和局部流程变量不同的是,流程变量绑定的是任务ID,如下图
而RuntimeService绑定的是act_ru_execution表的executionId。任务ID随着任务节点的变化而变化,而executionId一般不会改变。
- 同样,用RuntimeService设置的值同样在接下来的流程都可以获取,知道流程结束
(九)Activitivi5之使用 RuntimeService 设置和获取流程变量的更多相关文章
- C#设置和获取系统环境变量
C#设置和获取环境变量 1.前言 本来想拿学校机房的Android编辑器直接粘到自己电脑上用,发现它的eclipse是 32位的,而我的JDK是64位的,于是想到干脆装两个JDK,用C#做一个能够更改 ...
- (十)Activitivi5之启动流程/完成任务的时候设置流程变量
一.启动流程的时候设置流程变量 1.1 案例 /** * 启动流程实例 */ @Test public void start() { Student student=new Student(); st ...
- activiti设置流程变量
public static void mian(String args[]){ ProcessEngine processEngine = ProcessEngine.getDefaultProce ...
- python 获取系统环境变量 os.environ and os.putenv
从一段code说起 “if "BATCH_CONFIG_INI" in os.environ:” 判断环境变量的值有没有定义 如果定义的话就去环境变量的值,否则就取当前目录下的co ...
- js设置、获取单值cookie和多值cookie
js设置.获取单值cookie和多值cookie,代码如下: var CookieUtil = (function () { var Cookie = function () { // 获取单值coo ...
- 设置与获取Cookie
自己编写的一个Cookie设置与获取函数,大家有什么感觉需要改进的地方,请告知与我,我一定虚心接受. JavaScript - Code: function setCookie(name,value, ...
- php设置和获取cookie
php设置和获取cookie setcookie()调用只带有name参数的setcookie(); ()使失效时间为time()或time-; <?php setcookie(); PHP提供 ...
- js设置与获取Cookie
/*设置与获取Cookie*/ var Cookie ={} Cookie.write = function(key, value, duration){ var d = new Date(); d. ...
- java 获取系统变量(环境变量和设置变量)
前言 环境变量这个概念不陌生, 就是操作系统的环境变量. 系统变量就是java本身维护的变量. 通过 System.getProperty 的方式获取. 对于不同的操作系统来说, 环境变量的处理可能会 ...
随机推荐
- HTML中调用带有SoapHeader头的WebService的两种方法
第一种: function CallWebMethodWithHeader() { var soapXML = "<soap:Envelope xmlns:xsi='http://ww ...
- 咏南中间件新增MORMOT插件功能
咏南中间件新增MORMOT插件功能 咏南中间件支持DATASNAP和MORMOT两种通讯框架. 原来已经支持DATASNAP插件,现在又增加了MORMOT插件,已经支持DATASNAP和MORMOT两 ...
- Python 自学笔记(八)
import math def A(a,b): print("第一个参数的值为"+str(a)) print("第一个参数的值为"+str(b)) a = 1 ...
- 不建议在for循环中使用”+”进行字符串拼接
https://mp.weixin.qq.com/s/qG6bdhndAip9s-_XM9oP3A 为什么阿里巴巴不建议在for循环中使用”+”进行字符串拼接 互联网后端架构 1周前
- redis配置文件讲解
#redis.conf # Redis configuration file example. # ./redis-server /path/to/redis.conf ############### ...
- Qt编写数据导出到Excel及Pdf和打印数据
一.前言 用Qt开发已经九年了,期间用Qt做过不少的项目,在各种项目中有个功能很常用,尤其是涉及到数据记录存储的项目,那就是需要对查询的数据进行导出到Excel,或者导出到Pdf文件,或者直接打印查询 ...
- c/c++编码规范(3)--google代码规范检测工具cpplint.py
cpplint.py是来自google开源项目风格错误检测工具.它是一个python脚本,和google开源项目风格指南一同发布.下载地址:https://github.com/google/styl ...
- iOS-NSdata 与 NSString,Byte数组,UIImage 的相互转换
IOS---NSdata 与 NSString,Byte数组,UIImage 的相互转换 1. NSData 与 NSString NSData-> NSString NSString *aSt ...
- charles 批量重复请求/重复发包工具
本文参考:charles 批量请求 重复发包工具/repeat Charles 让你选择一个请求并重复,在测试后端接口的时候非常有用: Charles将请求重新发送到服务器,并将响应显示为新请求. 如 ...
- Python----数据预处理代码实例
为方便收藏学习,转载自:https://www.jb51.net/article/158168.htm 本文实例为大家分享了Python数据预处理的具体代码,供大家参考,具体内容如下 1.导入标准库 ...