VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > 编程开发 > Java教程 >
  • activiti 根据模型ID导出、预览 xml文件

复制代码
    /**根据模型ID导出xml文件
     * @param response
     * @param modelId    //模型ID
     * @from  fhadmin.cn
     */
    protected void exportXmlFromModelId(HttpServletResponse response, String modelId) throws Exception{
        Model modelData = repositoryService.getModel(modelId);  
        BpmnJsonConverter jsonConverter = new BpmnJsonConverter();  
        ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
        BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(modelNode);  
        BpmnXMLConverter xmlConverter = new BpmnXMLConverter();  
        byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);  
        ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);  
        //IOUtils.copy(in, response.getOutputStream());  
        String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml";  
        /*response.setHeader("Content-Disposition", "attachment; filename=" + filename);  
        response.flushBuffer(); */
        FileUpload.copyFile(in,PathUtil.getProjectpath()+Const.FILEACTIVITI,filename);         //把文件上传到文件目录里面
        FileDownload.fileDownload(response, PathUtil.getProjectpath()+Const.FILEACTIVITI+filename, filename);
        in.close();
    }
    
    /**根据模型ID预览xml文件
     * @param response
     * @param modelId    //模型ID
     * @from  fhadmin.org
     */
    protected String viewXmlFromModelId(String modelId) throws Exception{
        Model modelData = repositoryService.getModel(modelId);  
        BpmnJsonConverter jsonConverter = new BpmnJsonConverter();  
        ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
        BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(modelNode);  
        BpmnXMLConverter xmlConverter = new BpmnXMLConverter();  
        byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);  
        ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);  
        InputStreamReader isr = new InputStreamReader(in,"utf-8");
        BufferedReader bufferedReader = new BufferedReader(isr);
        StringBuffer xmlContent = new StringBuffer(); 
        String lineTxt = null;
        while ((lineTxt = bufferedReader.readLine()) != null) {
            xmlContent.append(lineTxt);
            xmlContent.append("\n");
        }
        isr.close();
        return xmlContent.toString();
    }
 
复制代码

--------------------fhadmin.cn----------------------------------------------自定义表单
28. 定义模版:拖拽左侧表单元素到右侧区域,编辑表单元素,保存表单模版
29. 表单模版:编辑维护表单模版,复制表单模版,修改模版类型,预览表单模版
30. 我的表单:选择表单模版,编辑表单规则,是否上传图片、附件、开启富文本、挂靠流程开关等
31. 表单数据:从我的表单进去可增删改查表单数据,修改表单规则
32. 挂靠记录:记录表单数据和流程实例ID关联记录,可删除

来源:
https://www.cnblogs.com/m170981362621/p/15469405.html


相关教程