码迷,mamicode.com
首页 > 其他好文 > 详细

activiti5.15中文乱码问题

时间:2014-06-18 19:19:32      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   ext   color   

解决方式:

1.配置文件插入

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
        <property name="dataSource" ref="dataSource" />
        <property name="databaseSchemaUpdate" value="true" />
        <property name="transactionManager" ref="transactionManager" />
        <!-- 中文乱码问题 -->
        <property name="activityFontName" value="宋体"></property>
        <property name="labelFontName" value="宋体"/>
    </bean>

 

2.生成图片代码中增加

public InputStream getDiagram(String processInstanceId) {
        // 查询流程实例
        ProcessInstance pi = this.runtimeService.createProcessInstanceQuery()
                .processInstanceId(processInstanceId).singleResult();
        // 强制类型转换为RepositoryServiceImpl
        RepositoryServiceImpl rs = (RepositoryServiceImpl) this.processEngine
                .getRepositoryService();
        //1使用Spring注入
        ProcessEngineConfigurationImpl processEngineConfigurationImpl = ((ProcessEngineImpl) this.processEngine)
                .getProcessEngineConfiguration();
        Context.setProcessEngineConfiguration(processEngineConfigurationImpl);
       //2.不使用Spring注入
        // ProcessEngineImpl defaultProcessEngine = (ProcessEngineImpl) ProcessEngines
        // .getDefaultProcessEngine();
        // Context.setProcessEngineConfiguration(defaultProcessEngine
        // .getProcessEngineConfiguration());
        BpmnModel bpmnModel = repositoryService.getBpmnModel(pi
                .getProcessDefinitionId());
        // 转换为输入流
        InputStream is = ProcessDiagramGenerator.generateDiagram(bpmnModel,
                "png", runtimeService.getActiveActivityIds(processInstanceId));
        return is;
    }

activiti5.15中文乱码问题,布布扣,bubuko.com

activiti5.15中文乱码问题

标签:style   class   blog   code   ext   color   

原文地址:http://www.cnblogs.com/humeng126/p/3790602.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!