Java Code Examples for org.flowable.engine.repository.ProcessDefinition#getDiagramResourceName()
The following examples show how to use
org.flowable.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 flowable-engine with Apache License 2.0 | 6 votes |
@Deployment(resources = { "org/activiti/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.bpmn20.xml", "org/activiti/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg" }) public void testProcessDiagramResource() { ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); assertEquals("org/activiti/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.bpmn20.xml", processDefinition.getResourceName()); assertTrue(processDefinition.hasStartFormKey()); String diagramResourceName = processDefinition.getDiagramResourceName(); assertEquals("org/activiti/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg", diagramResourceName); InputStream diagramStream = repositoryService.getResourceAsStream(deploymentIdFromDeploymentAnnotation, "org/activiti/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg"); byte[] diagramBytes = IoUtil.readInputStream(diagramStream, "diagram stream"); assertEquals(33343, diagramBytes.length); }
Example 2
Source File: RestResponseFactory.java From flowable-engine with Apache License 2.0 | 6 votes |
public ProcessDefinitionResponse createProcessDefinitionResponse(ProcessDefinition processDefinition, RestUrlBuilder urlBuilder) { ProcessDefinitionResponse response = new ProcessDefinitionResponse(); response.setUrl(urlBuilder.buildUrl(RestUrls.URL_PROCESS_DEFINITION, processDefinition.getId())); response.setId(processDefinition.getId()); response.setKey(processDefinition.getKey()); response.setVersion(processDefinition.getVersion()); response.setCategory(processDefinition.getCategory()); response.setName(processDefinition.getName()); response.setDescription(processDefinition.getDescription()); response.setSuspended(processDefinition.isSuspended()); response.setStartFormDefined(processDefinition.hasStartFormKey()); response.setGraphicalNotationDefined(processDefinition.hasGraphicalNotation()); response.setTenantId(processDefinition.getTenantId()); // Links to other resources response.setDeploymentId(processDefinition.getDeploymentId()); response.setDeploymentUrl(urlBuilder.buildUrl(RestUrls.URL_DEPLOYMENT, processDefinition.getDeploymentId())); response.setResource(urlBuilder.buildUrl(RestUrls.URL_DEPLOYMENT_RESOURCE, processDefinition.getDeploymentId(), processDefinition.getResourceName())); if (processDefinition.getDiagramResourceName() != null) { response.setDiagramResource(urlBuilder.buildUrl(RestUrls.URL_DEPLOYMENT_RESOURCE, processDefinition.getDeploymentId(), processDefinition.getDiagramResourceName())); } return response; }
Example 3
Source File: BpmnDeploymentTest.java From flowable-engine with Apache License 2.0 | 6 votes |
@Test @Deployment(resources = { "org/flowable/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.bpmn20.xml", "org/flowable/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg" }) public void testProcessDiagramResource(@DeploymentId String deploymentIdFromDeploymentAnnotation) { ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult(); assertThat(processDefinition.getResourceName()).isEqualTo("org/flowable/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.bpmn20.xml"); BpmnModel processModel = repositoryService.getBpmnModel(processDefinition.getId()); List<StartEvent> startEvents = processModel.getMainProcess().findFlowElementsOfType(StartEvent.class); assertThat(startEvents) .extracting(StartEvent::getFormKey) .containsExactly("someFormKey"); String diagramResourceName = processDefinition.getDiagramResourceName(); assertThat(diagramResourceName).isEqualTo("org/flowable/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg"); InputStream diagramStream = repositoryService.getResourceAsStream(deploymentIdFromDeploymentAnnotation, "org/flowable/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg"); byte[] diagramBytes = IoUtil.readInputStream(diagramStream, "diagram stream"); assertThat(diagramBytes.length).isEqualTo(33343); }
Example 4
Source File: GetDeploymentProcessDiagramCmd.java From flowable-engine with Apache License 2.0 | 6 votes |
@Override public InputStream execute(CommandContext commandContext) { ProcessDefinition processDefinition = commandContext .getProcessEngineConfiguration() .getDeploymentManager() .findDeployedProcessDefinitionById(processDefinitionId); String deploymentId = processDefinition.getDeploymentId(); String resourceName = processDefinition.getDiagramResourceName(); if (resourceName == null) { LOGGER.info("Resource name is null! No process diagram stream exists."); return null; } else { InputStream processDiagramStream = new GetDeploymentResourceCmd(deploymentId, resourceName) .execute(commandContext); return processDiagramStream; } }
Example 5
Source File: GetDeploymentProcessDiagramCmd.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public InputStream execute(CommandContext commandContext) { ProcessDefinition processDefinition = CommandContextUtil.getProcessEngineConfiguration(commandContext).getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId); String deploymentId = processDefinition.getDeploymentId(); String resourceName = processDefinition.getDiagramResourceName(); if (resourceName == null) { LOGGER.info("Resource name is null! No process diagram stream exists."); return null; } else { InputStream processDiagramStream = new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext); return processDiagramStream; } }