(九)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 的方式获取. 对于不同的操作系统来说, 环境变量的处理可能会 ...
随机推荐
- CTR预估之LR与GBDT融合
转载自:http://www.cbdio.com/BigData/2015-08/27/content_3750170.htm 1.背景 CTR预估,广告点击率(Click-Through Rate ...
- 字节组数(二进制流)、Base64、图片(文件)、二进制相互之间转换
using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; ...
- cat file | while read line的问题
循环中的重定向 或许你应该在其他脚本中见过下面的这种写法: while read line do … done < file 刚开始看到这种结构时,很难理解< file是如何 ...
- OpenJudge计算概论-分离整数的各个数位
/*================================================================= 分离整数的各个数位 总时间限制: 1000ms 内存限制: 65 ...
- Oracle 表的行数、表占用空间大小,列的非空行数、列占用空间大小 查询
--表名,表占用空间大小(MB),行数select table_name, round(num_rows * avg_row_len /1024/1024, 8) as total_len, num_ ...
- java获取properties配置文件中某个属性最简单方法
假如我想获取src目录下sysConfig.properties中的uploadpath属性的值 方法如下所示: private static final ResourceBundle bundle ...
- jmeter -- beanshell 执行本地py文件
Process proc = Runtime.getRuntime().exec("python /Users/lucax/Desktop/工作/Ai双师项目/性能优化迭代_脚本准备/获取学 ...
- CentOS7下搭建zabbix监控(三)——Zabbix监控服务配置
CentOS7下搭建zabbix监控(一)——Zabbix监控端配置 CentOS7下搭建zabbix监控(二)——Zabbix被监控端配置 (1).配置Zabbix监控Apache服务 主机名:yo ...
- iOS-textfield控制光标开始位置
// UIView *paddingView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.wi ...
- SMOS数据产品介绍与下载方法
1. SMOS数据介绍 The Soil Moisture and Ocean Salinity (SMOS) 卫星是欧空局发射的一颗以探测地球土壤水含量以及海表盐度为目标的卫星,卫星所搭载的唯一载荷 ...