activiti 获取流程图

activiti 获取流程图

activiti在部署的时候将 bgmn和生成的图片 png,存放到ACT_GE_BYTEARRAY表中,需要在显示流程图的时候,直接从数据库查出即可

@Test
    public void viewImage() throws IOException{
        Deployment deployment = repositoryService.createDeploymentQuery().list().get(0);
        String id = deployment.getId();
        List names = repositoryService.getDeploymentResourceNames(id);
        String imageName = "";
        for (String name : names) {
            System.out.println("name:"+name);
            if(name.indexOf(".png")>=0){
                imageName = name;
            }
        }
        if(imageName!=""){
            File file = new File("c://"+imageName);
            FileUtils.copyInputStreamToFile(repositoryService.getResourceAsStream(id, imageName), file);
            file.createNewFile();
        }
    }

你可能感兴趣的:(activiti,学习总结)