generateJpgDiagram does not draw the lines

#1

Hi,

I’m using Flowable 6.4.1 and trying to retrieve the diagram image, but the flow of the connectors are not appearing. All the other images appear correctly. And if I use the TASK-UI, the js library design the connectors correctly with the same information. I already tried with diferent image types, scales, diagrams, but no success until now…

code snippet:
/ 2. deploy basic process model
BpmnModel bpmnModel = new BpmnModel();
bpmnModel.addProcess(process);
RepositoryService repositoryService = processEngine.getRepositoryService();
try {
BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
BpmnAutoLayout bpmnLayout = new BpmnAutoLayout(bpmnModel);
bpmnLayout.setTaskHeight(120);
bpmnLayout.setTaskWidth(120);
bpmnLayout.execute();
try {
ProcessDiagramGenerator processDiagramGenerator = new DefaultProcessDiagramGenerator();
InputStream inputSt = processDiagramGenerator.generateJpgDiagram(bpmnModel);
IOUtils.copy(inputSt, new FileOutputStream("/home/" + process.getName() + “lets_try_this” + “.jpg”));
} catch (IOException e) {
e.printStackTrace();
}

The bpmn diagram, with a
System.out.println(new String(bpmnXMLConverter.convertToXML(bpmnModel), “UTF-8”)):

But there are no connectors, as you can see:
image

Anyone with this issue?
Thanks in advance,
Filipe

#2

Hi Filipe,

Try this one and this should work.

	InputStream inputStream = null;
	ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
			.processInstanceId(workflowInstanceId).singleResult();

	if (processInstance == null)
		throw new FlowableIllegalArgumentException("processInstance is NULL");

	ProcessDefinition pde = repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());

	if (pde != null && pde.hasGraphicalNotation()) {
		BpmnModel bpmnModel = repositoryService.getBpmnModel(pde.getId());
		ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
		inputStream = diagramGenerator.generateDiagram(bpmnModel, "png",
				runtimeService.getActiveActivityIds(processInstance.getId()), Collections.<String>emptyList(),
				processEngineConfiguration.getActivityFontName(), processEngineConfiguration.getLabelFontName(),
				processEngineConfiguration.getAnnotationFontName(), processEngineConfiguration.getClassLoader(),
				1.0);
	}

Thanks,
Vijay.V

#3

Hi Vijay.V,

Thank you very much for your answer. I’ve already tried this approach in the past and it didn’t draw the lines, but now I found the problem: I was using a BpmnModel instance that was instantiated before the deploy. When I changed the bpmnModel value to repositoryService.getBpmnModel(pde.getId()) (after the process deploy) my lines appeared!
The confusion for me, was it was drawing the tasks and other elements but not the flows.

Thank you for this quick answer. Now all appears in the image!!

Regards,
Filipe