use of org.activiti.bpmn.model.Process in project Activiti by Activiti.
the class WorkflowDefinitionConversion method convert.
/**
* Call this method to actually execute the conversion of the {@link WorkflowDefinition}
* which was provided in the constructor.
*/
public void convert() {
if (workflowDefinition == null) {
throw new SimpleWorkflowException("Cannot start conversion: need to set a WorkflowDefinition first!");
}
this.incrementalIdMapping = new HashMap<String, Integer>();
this.additionalArtifacts = new HashMap<String, Object>();
// Create new process
bpmnModel = new BpmnModel();
process = new Process();
bpmnModel.addProcess(process);
// Let conversion listeners know initialization is finished
if (conversionFactory.getAllWorkflowDefinitionConversionListeners() != null) {
for (WorkflowDefinitionConversionListener conversionListener : conversionFactory.getAllWorkflowDefinitionConversionListeners()) {
conversionListener.beforeStepsConversion(this);
}
}
// Convert each step
convertSteps(workflowDefinition.getSteps());
// Let conversion listeners know step conversion is done
if (conversionFactory.getAllWorkflowDefinitionConversionListeners() != null) {
for (WorkflowDefinitionConversionListener conversionListener : conversionFactory.getAllWorkflowDefinitionConversionListeners()) {
conversionListener.afterStepsConversion(this);
}
}
// Add DI information to bpmn model
BpmnAutoLayout bpmnAutoLayout = new BpmnAutoLayout(bpmnModel);
bpmnAutoLayout.execute();
}
use of org.activiti.bpmn.model.Process in project Activiti by Activiti.
the class PoolConverterTest method validateModel.
private void validateModel(BpmnModel model) {
String idPool = "idPool";
String idProcess = "poolProcess";
assertEquals(1, model.getPools().size());
Pool pool = model.getPool(idPool);
assertEquals(idPool, pool.getId());
assertEquals(idProcess, pool.getProcessRef());
assertTrue(pool.isExecutable());
Process process = model.getProcess(idPool);
assertEquals(idProcess, process.getId());
assertTrue(process.isExecutable());
assertEquals(3, process.getLanes().size());
Lane lane = process.getLanes().get(0);
assertEquals("idLane1", lane.getId());
assertEquals("Lane 1", lane.getName());
assertEquals(7, lane.getFlowReferences().size());
assertTrue(lane.getFlowReferences().contains("startevent"));
assertTrue(lane.getFlowReferences().contains("usertask1"));
assertTrue(lane.getFlowReferences().contains("usertask6"));
assertTrue(lane.getFlowReferences().contains("endevent"));
lane = process.getLanes().get(1);
assertEquals("idLane2", lane.getId());
assertEquals("Lane 2", lane.getName());
assertEquals(4, lane.getFlowReferences().size());
assertTrue(lane.getFlowReferences().contains("usertask2"));
assertTrue(lane.getFlowReferences().contains("usertask5"));
lane = process.getLanes().get(2);
assertEquals("idLane3", lane.getId());
assertEquals("Lane 3", lane.getName());
assertEquals(4, lane.getFlowReferences().size());
assertTrue(lane.getFlowReferences().contains("usertask3"));
assertTrue(lane.getFlowReferences().contains("usertask4"));
assertNotNull(process.getFlowElement("startevent"));
assertNotNull(process.getFlowElement("usertask1"));
assertNotNull(process.getFlowElement("usertask2"));
assertNotNull(process.getFlowElement("usertask3"));
assertNotNull(process.getFlowElement("usertask4"));
assertNotNull(process.getFlowElement("usertask5"));
assertNotNull(process.getFlowElement("usertask6"));
assertNotNull(process.getFlowElement("endevent"));
assertNotNull(process.getFlowElement("flow1"));
assertNotNull(process.getFlowElement("flow2"));
assertNotNull(process.getFlowElement("flow3"));
assertNotNull(process.getFlowElement("flow4"));
assertNotNull(process.getFlowElement("flow5"));
assertNotNull(process.getFlowElement("flow6"));
assertNotNull(process.getFlowElement("flow7"));
}
Aggregations