Java Code Examples for org.camunda.bpm.engine.repository.ProcessDefinition#getDiagramResourceName()
The following examples show how to use
org.camunda.bpm.engine.repository.ProcessDefinition#getDiagramResourceName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BpmnDeploymentTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Deployment(resources={ "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.bpmn20.xml", "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg" }) public void testProcessDiagramResource() { ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); assertEquals("org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.bpmn20.xml", processDefinition.getResourceName()); assertTrue(processDefinition.hasStartFormKey()); String diagramResourceName = processDefinition.getDiagramResourceName(); assertEquals("org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg", diagramResourceName); InputStream diagramStream = repositoryService.getResourceAsStream(deploymentId, "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg"); byte[] diagramBytes = IoUtil.readInputStream(diagramStream, "diagram stream"); assertEquals(33343, diagramBytes.length); }
Example 2
Source File: ProcessDefinitionDto.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public static ProcessDefinitionDto fromProcessDefinition(ProcessDefinition definition) { ProcessDefinitionDto dto = new ProcessDefinitionDto(); dto.id = definition.getId(); dto.key = definition.getKey(); dto.category = definition.getCategory(); dto.description = definition.getDescription(); dto.name = definition.getName(); dto.version = definition.getVersion(); dto.resource = definition.getResourceName(); dto.deploymentId = definition.getDeploymentId(); dto.diagram = definition.getDiagramResourceName(); dto.suspended = definition.isSuspended(); dto.tenantId = definition.getTenantId(); dto.versionTag = definition.getVersionTag(); dto.historyTimeToLive = definition.getHistoryTimeToLive(); dto.isStartableInTasklist = definition.isStartableInTasklist(); return dto; }
Example 3
Source File: HalProcessDefinition.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public static HalProcessDefinition fromProcessDefinition(ProcessDefinition processDefinition, ProcessEngine processEngine) { HalProcessDefinition halProcDef = new HalProcessDefinition(); halProcDef.id = processDefinition.getId(); halProcDef.key = processDefinition.getKey(); halProcDef.category = processDefinition.getCategory(); halProcDef.description = processDefinition.getDescription(); halProcDef.name = processDefinition.getName(); halProcDef.version = processDefinition.getVersion(); halProcDef.versionTag = processDefinition.getVersionTag(); halProcDef.resource = processDefinition.getResourceName(); halProcDef.deploymentId = processDefinition.getDeploymentId(); halProcDef.diagram = processDefinition.getDiagramResourceName(); halProcDef.suspended = processDefinition.isSuspended(); halProcDef.contextPath = ApplicationContextPathUtil.getApplicationPathForDeployment(processEngine, processDefinition.getDeploymentId()); halProcDef.linker.createLink(REL_SELF, processDefinition.getId()); halProcDef.linker.createLink(REL_DEPLOYMENT, processDefinition.getDeploymentId()); halProcDef.linker.createLink(REL_DEPLOYMENT_RESOURCE, processDefinition.getDeploymentId(), processDefinition.getResourceName()); return halProcDef; }
Example 4
Source File: ProcessDefinitionResourceImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Override public Response getProcessDefinitionDiagram() { ProcessDefinition definition = engine.getRepositoryService().getProcessDefinition(processDefinitionId); InputStream processDiagram = engine.getRepositoryService().getProcessDiagram(processDefinitionId); if (processDiagram == null) { return Response.noContent().build(); } else { String fileName = definition.getDiagramResourceName(); return Response.ok(processDiagram) .header("Content-Disposition", "attachment; filename=\"" + fileName + "\"") .type(getMediaTypeForFileSuffix(fileName)).build(); } }