cancel
Showing results for 
Search instead for 
Did you mean: 

How to dynamically generate a flowchart of vertical layout

hankzhousandy
Champ in-the-making
Champ in-the-making

new BpmnAutoLayout(model).execute();

this create a  flowchart  of horizontal layout,How to dynamically generate a flowchart of vertical layout?

3 REPLIES 3

cjose
Elite Collaborator
Elite Collaborator

Not sure if I understood the question, could you please explain the use case/question a little bit more so that we can help?

hankzhousandy
Champ in-the-making
Champ in-the-making
process.addFlowElement(createStartEvent());
process.addFlowElement(createUserTask("task1", "node01", "candidateGroup1"));
process.addFlowElement(createUserTask("task2", "node02", "candidateGroup2"));
process.addFlowElement(createEndEvent());

process.addFlowElement(createSequenceFlow("startEvent", "task1", "", ""));
process.addFlowElement(createSequenceFlow("task1", "task2", "", ""));
process.addFlowElement(createSequenceFlow("task2", "endEvent", "", ""));
// 2. Generate graphical information
new BpmnAutoLayout(model).execute();
// 3. Deploy the process to the engine
Deployment deployment = repositoryService.createDeployment()
        .addBpmnModel(PROCESS_ID+".bpmn", model).name(PROCESS_ID+"_deployment").deploy();
// 4. Start a process instance
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_ID);

// 5. Check if task is available
List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
Assert.assertEquals(1, tasks.size());

// 6. Save process diagram to a file
InputStream processDiagram = repositoryService
        .getProcessDiagram(processInstance.getProcessDefinitionId());
FileUtils.copyInputStreamToFile(processDiagram, new File("/deployments/"+PROCESS_ID+".png"));

the code, png show horizontal

i like this 

I don't know how to do it

So you probably need to hack your own version of 

new BpmnAutoLayout(model)

And probably check this: Activiti/BpmnAutoLayout.java at develop · Activiti/Activiti · GitHub 

Getting started

Explore our Alfresco products with the links below. Use labels to filter content by product module.