activiti当前任务高亮(解决乱码问题)
package com.xinwei; import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List; import org.activiti.bpmn.model.BpmnModel;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task;
import org.activiti.image.ProcessDiagramGenerator;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; public class TraceProcessInstaceUtil {
public static void main(String[] args) {
generateImage("");
}
public static byte[] generateImage(String processInstanceId){
//1.创建核心引擎流程对象processEngine
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
TaskService taskService = processEngine.getTaskService();
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();
//流程定义
BpmnModel bpmnModel = processEngine.getRepositoryService().getBpmnModel(task.getProcessDefinitionId()); //正在活动节点
List<String> activeActivityIds = processEngine.getRuntimeService().getActiveActivityIds(task.getExecutionId()); ProcessDiagramGenerator pdg = processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator(); //得到图片输出流(这样加可防止生成的流程图片乱码)
InputStream inputStream = processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator()
.generateDiagram(bpmnModel, "png", activeActivityIds, new ArrayList(),
processEngine.getProcessEngineConfiguration().getActivityFontName(),
processEngine.getProcessEngineConfiguration().getLabelFontName(), null, 1.0);
try {
//生成本地图片
File file = new File("D:/test1.png");
FileUtils.copyInputStreamToFile(inputStream, file);
System.out.println("生成流程图成功");
return IOUtils.toByteArray(inputStream);
} catch (Exception e) {
throw new RuntimeException("生成流程图异常!", e);
} finally {
IOUtils.closeQuietly(inputStream);
}
}
}
附:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <bean id="processEngineConfiguration"
class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
<!-- 连接数据的配置 -->
<property name="jdbcDriver" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl"
value="jdbc:mysql://localhost:3306/activitidemo?useUnicode=true&characterEncoding=utf8"></property>
<property name="jdbcUsername" value="root"></property>
<property name="jdbcPassword" value="xinwei"></property>
<property name="activityFontName" value="宋体" />
<property name="labelFontName" value="宋体" />
<!-- 没有表创建表 -->
<property name="databaseSchemaUpdate" value="true"></property>
</bean> </beans>
activiti当前任务高亮(解决乱码问题)的更多相关文章
- 为sublime安装package control 解决乱码问题 Mac版
为sublime安装package control Mac版参考 https://sublime.wbond.net/installation 防止中文乱码其实只需要2个东东 一个GBK enc ...
- SpringMVC解决乱码
SpringMVC解决乱码 在web.xml中配置如下代码
- http get/post解决乱码问题
<form method="默认为get"-> <s:form mothod="默认为post"-> ================= ...
- 上传Text文档并转换为PDF(解决乱码)
前些日子,Insus.NET有分享一篇<上传Text文档并转换为PDF>http://www.cnblogs.com/insus/p/4313092.html 它是按最简单与默认方式来处理 ...
- mysql 使用set names 解决乱码问题的原理
解决乱码的方法,我们经常使用“set names utf8”,那么为什么加上这句代码就可以解决了呢?下面跟着我一起来深入set names utf8的内部执行原理 先说MySQL的字符集问题.Wind ...
- php 解决乱码的通用方法
一,出现乱码的原因分析 1,保存文件时候,文件有自己的文件编码,就是汉字,或者其他国语言,以什么编码来存储 2,输出的时候,要给内容指定编码,如以网页的形势输入时<meta http-equiv ...
- Python字符串的encode与decode研究心得——解决乱码问题
转~Python字符串的encode与decode研究心得——解决乱码问题 为什么Python使用过程中会出现各式各样的乱码问题,明明是中文字符却显示成“/xe4/xb8/xad/xe6/x96/x8 ...
- window安装mysql5.7解压版(解决乱码问题)
♣安装mysql两种方法 ♣下载mysql5.7解压版 ♣配置步骤 ♣解决服务无法启动 ♣解决乱码 1.安装mysql两种方法 MySQL安装文件分为两种,一种是msi格式的,一种是zip格式的.如果 ...
- 编译VisualVM源码解决乱码问题
编译VisualVM源码解决乱码问题 起因 今天在使用VisualVM对测试服务器进行JVM监控的时候,发现所有统计图的横纵坐标都是显示乱码(小方块),即使我的Ubuntu系统使用的是英文语言环境.奇 ...
随机推荐
- tomcat服务器奇异事件
我在A电脑里面启动服务器,服务器里面之前上传了XX文件,然后在A电脑浏览器能访问到(但是修改无效),在B电脑也能访问到(修改有效果),现在我把A电脑里面的文件删除,在A电脑都能访问到但是修改不了文件, ...
- Object-C 1.0 第二章
1. 输出obc #import <Foundation/Foundation.h> int main(int argc,const char *argv[]) { NSLog(@&qu ...
- 集合知识点一 Collection(List)
- 学习AOP之JAVA的代理机制
从一个输出日志的实例分析JAVA的代理机制 一.通用的日志输出方法 :需要在每个类里都增加对输出日志信息的代码 二.通过面向接口编程实现日志的输出(JAVA的静态代理):虽然实现了业务逻辑与输出日志 ...
- [LintCode] Delete Node in the Middle of Singly Linked List 在单链表的中间删除节点
Implement an algorithm to delete a node in the middle of a singly linked list, given only access to ...
- Unity3D设计原则
原则1:单一职责 原则2:里氏替换原则(子类扩展但不改变父类功能) 原则3:依赖倒置原则 原则4:接口隔离原则 原则5:迪米特法则(最少知道原则) 原则6:开闭原则 原则1:单一职责原则 说到单一职责 ...
- vi 技巧和诀窍~转IBM
复合搜索 1 #!/bin/ksh 2 # 3 echo "Starting" 4 file=${1} 5 6 echo ${file} 7 8 if [[ ${file} = 1 ...
- css基础知识
CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明.其中选择器通常是您需要改变样式的 HTML 元素(比如p标签),也可以是节点的属性的值(比如id,class):每条声明都是一条字典key ...
- Objc Block
ref1 一.__block 的使用 说明: 在 block 内只能读取在同一个作用域的变数而且没有办法修改在 block 外定义的任何变数,此时若我们想要这些变数能够在 block 中被修改,就必须 ...
- servlet中service() 和doGet() 、doPost() 学习笔记
Sevlet接口定义如下: 与Sevlet接口相关的结构图: service() 方法是 Servlet 的核心.每当一个客户请求一个HttpServlet 对象,该对象的service() 方法就要 ...