cancel
Showing results for 
Search instead for 
Did you mean: 

Shift between repositoryService.getProcessDiagram() and repositoryService.getProcessDiagramLayout()

jacek
Champ in-the-making
Champ in-the-making
Hi,

I need to provide process diagram with marked current state of exdcution.
I use repositoryService.getProcessDiagram() image, and draw on it, using nodes positions from repositoryService.getProcessDiagramLayout().
But sometimes (on some processes) I have a shift (several points) between diagram received from getProcessDiagram method and positions received from getProcessDiagramLayout method.

Is this a bug, or i am doing it wrong?

Examle code:

ProcessInstance processInstance = processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(processId).singleResult();
String processDefinitionId = processInstance.getProcessDefinitionId();

InputStream diagramInputStream = processEngine.getRepositoryService().getProcessDiagram(processDefinitionId);
DiagramLayout diagramLayout = processEngine.getRepositoryService().getProcessDiagramLayout(processDefinitionId);

BufferedImage diagramImage = ImageIO.read(diagramInputStream);
Graphics graphics = diagramImage.getGraphics();

List<Execution> executions = processEngine.getRuntimeService().createExecutionQuery().processInstanceId(processId).list();
graphics.setColor(new Color(240, 100, 30));
for (Execution execution : executions) {
   DiagramNode node = diagramLayout.getNode(execution.getActivityId());
   if (node != null) {
      graphics.drawRoundRect(node.getX().intValue(), node.getY().intValue(), node.getWidth().intValue(), node.getHeight().intValue(), 25, 25);
   }
}

ByteArrayOutputStream diagramOutputStream = new ByteArrayOutputStream();
ImageIO.write(diagramImage, "PNG", diagramOutputStream);


Spring configuration:

  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    …….
    <property name="deploymentResources" value="classpath*:/process/*.bpmn" />
  </bean>

  <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
    <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  </bean>
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Jacek,

It is really hard to tell where the problem is. It can depend many things.
One hint could be to use
https://github.com/Activiti/Activiti/blob/0c4697b1495ae377850574d9449242136502629c/modules/activiti-...

public void drawHighLight(int x, int y, int width, int height) {…}
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.