标签:io ar os 使用 sp java for on log
一,使用普通方法:activti自动发布流程图片,通过流程ID找到流程,查出图片
//通过流程ID(XML上写的)找到流程 processDefinition = repositoryService.createProcessDefinitionQuery() .processDefinitionKey("flow_3") .singleResult(); String diagramResourceName = processDefinition.getDiagramResourceName(); logger.info(diagramResourceName); InputStream imageStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), diagramResourceName); //输出 int len = 0; byte[] b = new byte[1024]; while ((len = imageStream.read(b, 0, 1024)) != -1) { System.out.write(b, 0, len); }
二、通过activiti强大的managerservice
//查找所有流程 for (ProcessDefinition processDefinition : repositoryService.createProcessDefinitionQuery().list()) { logger.info(processDefinition.getKey()+processDefinition.getId()+processDefinition.getName()); }; //创建activiti的CMD Command cmd=null; //这里输入的流程ID,不是KEY cmd=new GetDeploymentProcessDiagramCmd("flow_3:1:904"); InputStream is = managementService.executeCommand(cmd); int len = 0; byte[] b = new byte[1024]; while ((len = is.read(b, 0, 1024)) != -1) { System.out.write(b, 0, len); }
标签:io ar os 使用 sp java for on log
原文地址:http://my.oschina.net/acitiviti/blog/350703