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


Java DefaultProcessDiagramGenerator类代码示例

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


DefaultProcessDiagramGenerator类属于org.activiti.image.impl包,在下文中一共展示了DefaultProcessDiagramGenerator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWorkflowImage

import org.activiti.image.impl.DefaultProcessDiagramGenerator; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public InputStream getWorkflowImage(String workflowInstanceId)
{
    String processInstanceId = createLocalId(workflowInstanceId);
    ExecutionEntity pi = (ExecutionEntity) runtimeService.createProcessInstanceQuery()
                .processInstanceId(processInstanceId).singleResult();

    // If the process is finished, there is no diagram available
    if (pi != null)
    {
        // Fetch the bpmn model
        BpmnModel model = repoService.getBpmnModel(pi.getProcessDefinitionId());

        if (model != null && model.getLocationMap().size() > 0) 
        {              
            ProcessDiagramGenerator generator = new DefaultProcessDiagramGenerator();
            return generator.generateDiagram(model,
                  ActivitiConstants.PROCESS_INSTANCE_IMAGE_FORMAT,
                  runtimeService.getActiveActivityIds(processInstanceId)); 
        }
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:ActivitiWorkflowEngine.java

示例2: getProcessInstanceDiagram

import org.activiti.image.impl.DefaultProcessDiagramGenerator; //导入依赖的package包/类
@GET
@Path("/{processInstanceId}/diagram")
@Produces(MediaType.APPLICATION_JSON)
public Response getProcessInstanceDiagram(@PathParam("processInstanceId") String processInstanceId) {
    ProcessInstance processInstance = getProcessInstanceFromRequest(processInstanceId);

    RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
    ProcessDefinition pde = repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());

    if (pde != null && pde.hasGraphicalNotation()) {
        RuntimeService runtimeService = BPMNOSGIService.getRuntimeService();

        InputStream diagramStream = new DefaultProcessDiagramGenerator().generateDiagram(repositoryService
                        .getBpmnModel(pde.getId()), "png",
                runtimeService.getActiveActivityIds(processInstanceId));
        try {
            return Response.ok().type("image/png").entity(IOUtils.toByteArray(diagramStream)).build();
        } catch (Exception e) {
            throw new ActivitiIllegalArgumentException("Error exporting diagram", e);
        }

    } else {
        throw new ActivitiIllegalArgumentException("Process instance with id '" + processInstance.getId()
                + "' has no graphical notation defined.");
    }
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:ProcessInstanceService.java

示例3: execute

import org.activiti.image.impl.DefaultProcessDiagramGenerator; //导入依赖的package包/类
public InputStream execute(CommandContext commandContext) {
    ProcessDefinitionEntity processDefinition = new GetDeploymentProcessDefinitionCmd(
            processDefinitionId).execute(commandContext);
    String diagramResourceName = processDefinition.getDiagramResourceName();
    String deploymentId = processDefinition.getDeploymentId();

    if (deploymentId != null) {
        byte[] bytes = commandContext
                .getResourceEntityManager()
                .findResourceByDeploymentIdAndResourceName(deploymentId,
                        diagramResourceName).getBytes();
        InputStream inputStream = new ByteArrayInputStream(bytes);

        return inputStream;
    }

    GetBpmnModelCmd getBpmnModelCmd = new GetBpmnModelCmd(
            processDefinitionId);
    BpmnModel bpmnModel = getBpmnModelCmd.execute(commandContext);
    ProcessEngineConfiguration processEngineConfiguration = Context
            .getProcessEngineConfiguration();
    InputStream is = new DefaultProcessDiagramGenerator().generateDiagram(
            bpmnModel, "png",
            processEngineConfiguration.getActivityFontName(),
            processEngineConfiguration.getLabelFontName(), null);

    return is;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:29,代码来源:ProcessDefinitionDiagramCmd.java

示例4: getDiagramByte

import org.activiti.image.impl.DefaultProcessDiagramGenerator; //导入依赖的package包/类
private static byte[] getDiagramByte(ProcessInstance pi) throws Exception {
	byte[] data = null;
	ProcessDiagramGenerator processDiagramGenerator = new DefaultProcessDiagramGenerator();
	BpmnModel model = repositoryService.getBpmnModel(pi.getProcessDefinitionId());
	InputStream is = processDiagramGenerator.generateDiagram(
			model, 
			"png", 
			runtimeService.getActiveActivityIds(pi.getId()));
	data = IOUtils.toByteArray(is);
	is.close();
	is = null;	
	return data;
}
 
开发者ID:billchen198318,项目名称:bamboobsc,代码行数:14,代码来源:BusinessProcessManagementUtils.java

示例5: getProcessImage

import org.activiti.image.impl.DefaultProcessDiagramGenerator; //导入依赖的package包/类
@Override
public BinaryResource getProcessImage(String processId)
{
    validateIfUserAllowedToWorkWithProcess(processId);
    
    ProcessInstance processInstance = activitiProcessEngine.getRuntimeService()
            .createProcessInstanceQuery()
            .processInstanceId(processId)
            .singleResult();
    
    if (processInstance == null)
    {
        throw new EntityNotFoundException(processId);
    }
    
    try
    {
    	BpmnModel model = activitiProcessEngine.getRepositoryService().getBpmnModel(processInstance.getProcessDefinitionId());
        
        if(model != null && model.getLocationMap().size() > 0)
        {
            List<String> activeActivities = activitiProcessEngine.getRuntimeService().getActiveActivityIds(processId);
            ProcessDiagramGenerator generator = new DefaultProcessDiagramGenerator();
            InputStream generateDiagram = generator.generateDiagram(model, "png", activeActivities);
            
            File file = TempFileProvider.createTempFile(processId + UUID.randomUUID(), ".png");
            FileOutputStream fos = new FileOutputStream(file);
            IOUtils.copy(generateDiagram, fos);
            fos.close();
            
            return new FileBinaryResource(file);
        }
        else
        {
            throw new EntityNotFoundException(processId + "/image");
        }
    }
    catch (IOException error)
    {
        throw new ApiException("Error while getting process image.");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:43,代码来源:ProcessesImpl.java


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