当前位置: 首页>>代码示例>>Java>>正文


Java ProcessDiagramGenerator类代码示例

本文整理汇总了Java中org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator的典型用法代码示例。如果您正苦于以下问题:Java ProcessDiagramGenerator类的具体用法?Java ProcessDiagramGenerator怎么用?Java ProcessDiagramGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProcessDiagramGenerator类属于org.activiti.engine.impl.bpmn.diagram包,在下文中一共展示了ProcessDiagramGenerator类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:24,代码来源:ActTaskService.java

示例2: testBuildWF

import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入依赖的package包/类
@Test
public void testBuildWF() throws IOException {
    List<Approval> approvals = Lists.newArrayList();

    Approval approval = new Approval();
    approval.getCandidateGroups().add("engineering");
    approvals.add(approval);

    Approval approval2 = new Approval();
    approval2.getCandidateUsers().add("kermit");
    approvals.add(approval2);

    BpmnModel model = workflowBldr.documentApprove(approvals, "engineering");

    InputStream in = ProcessDiagramGenerator.generatePngDiagram(model);
    FileUtils.copyInputStreamToFile(in, new File("target/some_group_diagram.png"));
    IOUtils.closeQuietly(in);
}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:19,代码来源:WorkflowBuilderTest.java

示例3: 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);
    }
}
 
开发者ID:ameizi,项目名称:activiti-demo,代码行数:25,代码来源:SimpleFlowWorkController.java

示例4: 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");
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:31,代码来源:ProcessInstanceDiagramResource.java

示例5: getProcessDefinitionDiagram

import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入依赖的package包/类
/**
 *
 * @param processId the process <strong>Definition</strong> Id - NOT the process Instance Id.
 * @return png image of diagram - nothing highlighted since this is the process definition - not a specific instance.
 */
byte[] getProcessDefinitionDiagram(String processId) throws IOException {
    ProcessDefinition pd =
            this.repoSrvc.createProcessDefinitionQuery().processDefinitionKey(processId).latestVersion().singleResult();
    log.debug("Getting process diagram for processId: " + pd.getId());
        BpmnModel model = repoSrvc.getBpmnModel(pd.getId());
    InputStream in = ProcessDiagramGenerator.generatePngDiagram(model);
    byte[] bytes = IOUtils.toByteArray(in);
    IOUtils.closeQuietly(in);
    log.debug("Got bytes of size: " + bytes.length);
    return bytes;
}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:17,代码来源:WorkflowService.java

示例6: 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;
}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:16,代码来源:WorkflowService.java

示例7: testRepoService

import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入依赖的package包/类
@Test
public void testRepoService() throws IOException {
    List<ProcessDefinition> pds = this.repositoryService.createProcessDefinitionQuery().list();
    log.debug("Number of pds: " + pds.size());
    for (ProcessDefinition pd : pds) {
        BpmnModel model = repositoryService.getBpmnModel(pd.getId());
        InputStream in = ProcessDiagramGenerator.generatePngDiagram(model);
        FileUtils.copyInputStreamToFile(in, new File("target/" + pd.getName() + "_diagram.png"));
        IOUtils.closeQuietly(in);
    }
}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:12,代码来源:WorkflowBuilderTest.java

示例8: testBuildDefaultWF

import org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator; //导入依赖的package包/类
@Test
public void testBuildDefaultWF() throws IOException {
    BpmnModel model = workflowBldr.defaultDocumentApprove();

    InputStream in = ProcessDiagramGenerator.generatePngDiagram(model);
    FileUtils.copyInputStreamToFile(in, new File("target/default_diagram.png"));
    IOUtils.closeQuietly(in);
}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:9,代码来源:WorkflowBuilderTest.java

示例9: 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;
  }
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:8,代码来源:ProcessCustomService.java

示例10: 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());
}
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:44,代码来源:DocumentApproveSubProcessTest.java

示例11: 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;
  }
 
开发者ID:v5developer,项目名称:maven-framework-project,代码行数:7,代码来源:ActivitiWorkFlowServiceImpl.java


注:本文中的org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。