private InputStream loadCSS(String deploymentId) { RepositoryService repoService = processEngine.getRepositoryService(); InputStream in = repoService.getResourceAsStream( deploymentId, PROCESSFORMS_CSS ); return in; } }
public byte[] getProcessImage(String processId) { RepositoryService repositoryService = this.processEngine.getRepositoryService(); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processId).uniqueResult(); String imgRes = processDefinition.getImageResourceName(); InputStream in = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), imgRes); if (null == in) throw new RuntimeException("Failed to retrieve image resource: " + imgRes); ByteArrayOutputStream out = new ByteArrayOutputStream(); final int BUF_SIZE = 1 << 8; // 1KiB buffer byte[] buffer = new byte[BUF_SIZE]; int bytesRead = -1; try { while ((bytesRead = in.read(buffer)) > -1) { out.write(buffer, 0, bytesRead); } in.close(); } catch (IOException e) { throw new RuntimeException("Failed to read image resource: " + imgRes, e); } byte[] imageBytes = out.toByteArray(); return imageBytes; }
if (processDefinition != null) { String imgRes = processDefinition.getImageResourceName(); inputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), imgRes);
InputStream template = repoService.getResourceAsStream(procDef.getDeploymentId(), startFormResourceName);
private InputStream loadCSS(String executionId) { RepositoryService repoService = processEngine.getRepositoryService(); ExecutionService execService = processEngine.getExecutionService(); Execution execution = execService.findExecutionById(executionId); if (execution != null) { ProcessDefinition definition = repoService.createProcessDefinitionQuery() .processDefinitionId(execution.getProcessDefinitionId()).uniqueResult(); InputStream in = repoService.getResourceAsStream(definition.getDeploymentId(), PROCESSFORMS_CSS); return in; } return null; } }
InputStream template = repoService.getResourceAsStream(procDef.getDeploymentId(), name);