(九)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 的方式获取. 对于不同的操作系统来说, 环境变量的处理可能会 ...
随机推荐
- [软工]Github的使用
注册 修改个人信息 fork项目 使用github客户端 commit项目 发送PR 注意事项 不要使用上述项目进行试验 建议Github用户名有规律,好记忆
- arcgis python 布局中所有元素信息报告
# Author: ESRI # Date: July 5, 2010 # Version: ArcGIS 10.0 # Purpose: This script generates a report ...
- javascript创建对象的几种方式?
javascript创建对象简单的说,无非就是使用内置对象或各种自定义对象,当然还可以用JSON:但写法有很多种,也能混合使用. 1.对象字面量的方式 person={ firstname:" ...
- presto计算日期间隔天数或者小时间隔——date_diff函数使用
“Presto是Facebook最新研发的数据查询引擎,可对250PB以上的数据进行快速地交互式分析.据称该引擎的性能是 Hive 的 10 倍以上.”,亲身用过之后,觉得比hive快了10倍不止. ...
- vue-resource在vuecli3中请求headers修改
this.$resource.delete({ user_code: Cookie.get("empid"), date: date, file_name: file_name } ...
- Java中运行动态脚本
这里主要总结Java中集成Groovy的应用. Groovy可以与Java完美集成来扩展我们的应用,比如替代Java+jexl实现算式表达式计算或其它功能.在Ofbiz中也集成了Groovy来执行一些 ...
- 关于Mysql-unknow-column-in-where-clause
写在前边: 已经很久不更新了啊,整个2月份几乎没有遇到什么新鲜事.直到昨天我又犯了一次傻,貌似只有我犯傻的时候才有材料可以跟大家分享- 问题表现: mysql 报错: unknow column 's ...
- 导入GoogleClusterData到MySQL
本篇随笔记录如何导入google-cluster-data-2011-1-2的 job_events和task_events到MySQL 1. 下载数据 download_job_events: im ...
- 38 Flutter仿京东商城项目 渲染结算页面商品数据
加群452892873 下载对应38课文件,运行方法,建好项目,直接替换lib目录 CartServices.dart import 'dart:convert'; import 'Storage.d ...
- 123457123456#0#-----com.threeapp.magicImageShow01----儿童宝宝魔法画笔
com.threeapp.magicImageShow01----儿童宝宝魔法画笔