Search in sources :

Example 1 with ProcessDiagramLayoutFactory

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);
}
Also used : InputStream(java.io.InputStream) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity) ProcessDiagramLayoutFactory(org.camunda.bpm.engine.impl.bpmn.diagram.ProcessDiagramLayoutFactory) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 2 with ProcessDiagramLayoutFactory

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);
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) DiagramLayout(org.camunda.bpm.engine.repository.DiagramLayout) ProcessDiagramLayoutFactory(org.camunda.bpm.engine.impl.bpmn.diagram.ProcessDiagramLayoutFactory) FileInputStream(java.io.FileInputStream)

Aggregations

InputStream (java.io.InputStream)2 ProcessDiagramLayoutFactory (org.camunda.bpm.engine.impl.bpmn.diagram.ProcessDiagramLayoutFactory)2 FileInputStream (java.io.FileInputStream)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)1 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)1 DiagramLayout (org.camunda.bpm.engine.repository.DiagramLayout)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1