return null;
String processDefinitionId = (String) getRequest().getAttributes().get("processDefinitionId");
if (processDefinitionId == null) {
throw new ActivitiException("No process definition id provided");
}
RepositoryService repositoryService = ActivitiUtil.getRepositoryService();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(processDefinitionId).singleResult();
if (processDefinition == null) {
throw new ActivitiException("Process definition " + processDefinitionId + " could not be found");
}
if (processDefinition.getDiagramResourceName() == null) {
throw new ActivitiException("Diagram resource could not be found");
}
final InputStream definitionImageStream = repositoryService.getResourceAsStream(
processDefinition.getDeploymentId(), processDefinition.getDiagramResourceName());
if (definitionImageStream == null) {
throw new ActivitiException("Diagram resource could not be found");
}
return new InputRepresentation(definitionImageStream, MediaType.IMAGE_PNG);
}