use of org.camunda.bpm.engine.impl.bpmn.diagram.ProcessDiagramLayoutFactory in project camunda-bpm-platform by camunda.
the class GetDeploymentProcessDiagramLayoutCmd method execute.
public DiagramLayout execute(final CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedProcessDefinitionById(processDefinitionId);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadProcessDefinition(processDefinition);
}
InputStream processModelStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {
public InputStream call() throws Exception {
return new GetDeploymentProcessModelCmd(processDefinitionId).execute(commandContext);
}
});
InputStream processDiagramStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {
public InputStream call() throws Exception {
return new GetDeploymentProcessDiagramCmd(processDefinitionId).execute(commandContext);
}
});
return new ProcessDiagramLayoutFactory().getProcessDiagramLayout(processModelStream, processDiagramStream);
}
use of org.camunda.bpm.engine.impl.bpmn.diagram.ProcessDiagramLayoutFactory in project camunda-bpm-platform by camunda.
the class ProcessDiagramRetrievalTest method testGetProcessDiagramLayout.
/**
* Tests {@link RepositoryService#getProcessDiagramLayout(String)} and
* {@link ProcessDiagramLayoutFactory#getProcessDiagramLayout(InputStream, InputStream)}.
*/
@Test
public void testGetProcessDiagramLayout() throws Exception {
DiagramLayout processDiagramLayout;
if (1 == processDefinitionQuery.count()) {
ProcessDefinition processDefinition = processDefinitionQuery.singleResult();
assertNotNull(processDefinition);
processDiagramLayout = repositoryService.getProcessDiagramLayout(processDefinition.getId());
} else {
// some test diagrams do not contain executable processes
// and are therefore ignored by the engine
InputStream bpmnXmlStream = new FileInputStream("src/test/resources/org/camunda/bpm/engine/test/api/repository/diagram/" + xmlFileName);
InputStream imageStream = new FileInputStream("src/test/resources/org/camunda/bpm/engine/test/api/repository/diagram/" + imageFileName);
assertNotNull(bpmnXmlStream);
assertNotNull(imageStream);
processDiagramLayout = new ProcessDiagramLayoutFactory().getProcessDiagramLayout(bpmnXmlStream, imageStream);
}
assertLayoutCorrect(processDiagramLayout);
}
Aggregations