当前位置: 代码迷 >> 综合 >> flowable 流程资源获取
  详细解决方案

flowable 流程资源获取

热度:57   发布时间:2023-11-25 04:06:34.0

流程资源获取

@Test
public void viewImage() throws IOException {String deploymentId = "5001";List<String> deploymentResourceNames = repositoryService.getDeploymentResourceNames(deploymentId);System.out.println(deploymentResourceNames);String imageName = null;for (String name : deploymentResourceNames) {
//png 为流程图 还有其他资源可以到数据库表查看if (name.indexOf(".png") > 0) {imageName = (name);}}System.out.println(imageName);if (imageName != null) {File file = new File("F:\\flowable\\" + imageName);InputStream resourceAsStream = repositoryService.getResourceAsStream(deploymentId, imageName);FileUtils.copyInputStreamToFile(resourceAsStream,file);}
}

deploymentId 为流程部署id

resourceName为act_ge_bytearray表中NAME_列的值

使用repositoryService的getDeloymentResourceNames可以获取指定部署下的所有文件名称

使用repositoryService的getResourceAsStream方法传入部署ID和资源图片名称可以获取部署下执行名称文件的输入流

查询部署对象(act_re_deployment )

/*** 查询部署对象* select RES.* from ACT_RE_DEPLOYMENT RES WHERE RES.ID_ = ? order by RES.ID_ asc */
@Test
public void createDeploymentQuery() {List<Deployment> list = repositoryService.createDeploymentQuery().list();list.forEach(v -> System.out.println(v.getId() + " " + v.getKey()));List<Deployment> list1 = repositoryService.createDeploymentQuery().deploymentId("15001").list();list1.forEach(v -> System.out.println(v.getId() + " " + v.getKey()));}
/*** +* 本地sql操作*/@Testpublic void createNativeDeploymentQuery() {List<Deployment> list = repositoryService.createNativeDeploymentQuery().sql("select RES.* from ACT_RE_DEPLOYMENT RES ").list();list.forEach(v -> System.out.println(v.getId() + " " + v.getKey()));}

Deployment部署对象

1.一次部署的多个文件的信息。对于不需要的流程可以删除和修改

2.对应的表

act_re_deployment:部署对象表

act_re_procdef:流程定义表

act_ge_bytearray:资源文件表

act_ge_property:主键生成策略表