本文整理汇总了Java中org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator.generateDiagram方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessDiagramGenerator.generateDiagram方法的具体用法?Java ProcessDiagramGenerator.generateDiagram怎么用?Java ProcessDiagramGenerator.generateDiagram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator
的用法示例。
在下文中一共展示了ProcessDiagramGenerator.generateDiagram方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tracePhoto
import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入方法依赖的package包/类
/**
* 读取带跟踪的图片
* @param executionId 环节ID
* @return 封装了各种节点信息
*/
public InputStream tracePhoto(String processDefinitionId, String executionId) {
// ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(executionId).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
List<String> activeActivityIds = Lists.newArrayList();
if (runtimeService.createExecutionQuery().executionId(executionId).count() > 0){
activeActivityIds = runtimeService.getActiveActivityIds(executionId);
}
// 不使用spring请使用下面的两行代码
// ProcessEngineImpl defaultProcessEngine = (ProcessEngineImpl)ProcessEngines.getDefaultProcessEngine();
// Context.setProcessEngineConfiguration(defaultProcessEngine.getProcessEngineConfiguration());
// 使用spring注入引擎请使用下面的这行代码
Context.setProcessEngineConfiguration(processEngine.getProcessEngineConfiguration());
return ProcessDiagramGenerator.generateDiagram(bpmnModel, "png", activeActivityIds);
}
示例2: viewPic
import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入方法依赖的package包/类
/**
* 显示图片
* @return
*/
@RequestMapping(value = "/viewPic.do")
public void viewPic(HttpServletRequest request,
HttpServletResponse response,
@RequestParam("executionId") String executionId) throws Exception{
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(executionId).singleResult();
BpmnModel bpmnModel = repositoryService.getBpmnModel(processInstance.getProcessDefinitionId());
List<String> activeActivityIds = runtimeService.getActiveActivityIds(executionId);
// 使用spring注入引擎请使用下面的这行代码
Context.setProcessEngineConfiguration(processEngine.getProcessEngineConfiguration());
InputStream imageStream = ProcessDiagramGenerator.generateDiagram(bpmnModel, "png", activeActivityIds);
// 输出资源内容到相应对象
byte[] b = new byte[1024];
int len;
while ((len = imageStream.read(b, 0, 1024)) != -1) {
response.getOutputStream().write(b, 0, len);
}
}
示例3: getInstanceDiagram
import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入方法依赖的package包/类
@Get
public InputRepresentation getInstanceDiagram() {
if(authenticate() == false) return null;
String processInstanceId = (String) getRequest().getAttributes().get("processInstanceId");
if(processInstanceId == null) {
throw new ActivitiException("No process instance id provided");
}
ExecutionEntity pi =
(ExecutionEntity) ActivitiUtil.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (pi == null) {
throw new ActivitiException("Process instance with id" + processInstanceId + " could not be found");
}
ProcessDefinitionEntity pde = (ProcessDefinitionEntity) ((RepositoryServiceImpl) ActivitiUtil.getRepositoryService())
.getDeployedProcessDefinition(pi.getProcessDefinitionId());
if (pde != null && pde.isGraphicalNotationDefined()) {
InputStream resource = ProcessDiagramGenerator.generateDiagram(pde, "png", ActivitiUtil.getRuntimeService().getActiveActivityIds(processInstanceId));
InputRepresentation output = new InputRepresentation(resource);
return output;
} else {
throw new ActivitiException("Process instance with id " + processInstanceId + " has no graphic description");
}
}
示例4: getActiveDocumentDiagram
import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入方法依赖的package包/类
byte[] getActiveDocumentDiagram(String docId) throws IOException {
log.debug("getting active diagram for doc: " + docId);
//http://forums.activiti.org/content/process-diagram-highlighting-current-process
ProcessInstance pi =
runtimeService.createProcessInstanceQuery().processInstanceBusinessKey(docId).singleResult();
RepositoryServiceImpl impl = (RepositoryServiceImpl)repoSrvc;
ProcessDefinitionEntity pde = (ProcessDefinitionEntity) impl.getDeployedProcessDefinition(pi.getProcessDefinitionId());
BpmnModel bpmnModel = repoSrvc.getBpmnModel(pde.getId());
InputStream in = ProcessDiagramGenerator.generateDiagram(bpmnModel, "png", runtimeService.getActiveActivityIds(pi.getProcessInstanceId()));
byte[] bytes = IOUtils.toByteArray(in);
IOUtils.closeQuietly(in);
log.debug("Got bytes of size: " + bytes.length);
return bytes;
}
示例5: getImageStream
import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入方法依赖的package包/类
public static InputStream getImageStream(String taskId) throws Exception{
ProcessDefinitionEntity pde = findProcessDefinitionEntityByTaskId(taskId);
InputStream imageStream = ProcessDiagramGenerator.generateDiagram(
pde, "png",
runtimeService.getActiveActivityIds(findProcessInstanceByTaskId(taskId).getId()));
return imageStream;
}
示例6: testDocApprovalFlow
import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入方法依赖的package包/类
@Test
public void testDocApprovalFlow() throws InterruptedException, IOException {
setSpringSecurity("kermit");
Document doc = new Document();
doc.setGroupId("engineering");
doc.setCreatedDate(new Date());
doc.setTitle("title");
doc.setSummary("Summary");
doc.setContent("content");
doc.setAuthor("kermit");
String docId;
docId = documentService.createDocument(doc);
log.debug("new doc id: " + docId);
this.documentService.submitForApproval(docId);
setSpringSecurity("fozzie");
List<TaskForm> tasks = this.localTaskService.getTasks("fozzie");
assertTrue(tasks.size() == 1);
TaskForm currentTask = tasks.get(0);
log.debug("got task: " + tasks.get(0).getName());
//http://forums.activiti.org/content/process-diagram-highlighting-current-process
RepositoryServiceImpl impl = (RepositoryServiceImpl)repoSrvc;
ProcessDefinitionEntity pde = (ProcessDefinitionEntity) impl.getDeployedProcessDefinition(currentTask.getProcessDefinitionId());
BpmnModel bpmnModel = repoSrvc.getBpmnModel(pde.getId());
InputStream in = ProcessDiagramGenerator.generateDiagram(bpmnModel, "png", runtimeService.getActiveActivityIds(currentTask.getProcessInstanceId()));
FileUtils.copyInputStreamToFile(in, new File("target/current-diagram.png"));
localTaskService.approveTask(true, "task approved blah blah blah", tasks.get(0).getId());
HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().
includeProcessVariables().processInstanceBusinessKey(docId).singleResult();
assertNotNull(pi);
log.debug("Duration time in millis: " + pi.getDurationInMillis());
List<HistoricTaskInstance> hTasks;
hTasks = historyService.createHistoricTaskInstanceQuery().includeTaskLocalVariables().processInstanceBusinessKey(docId).list();
assertTrue(hTasks.size() == 2);
HistoricTaskInstance approval = hTasks.get(1);
Map<String, Object> vars = approval.getTaskLocalVariables();
List<Comment> comments = taskService.getTaskComments(approval.getId());
}
示例7: getImageStream
import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入方法依赖的package包/类
public InputStream getImageStream(String taskId) throws Exception{
ProcessDefinitionEntity pde = findProcessDefinitionEntityByTaskId(taskId);
InputStream imageStream = ProcessDiagramGenerator.generateDiagram(pde, "png",
runtimeService.getActiveActivityIds(findProcessInstanceByTaskId(taskId).getId()));
return imageStream;
}