Search in sources :

Example 1 with WorkflowDefinitionConversionListener

use of org.activiti.workflow.simple.converter.listener.WorkflowDefinitionConversionListener 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();
}
Also used : WorkflowDefinitionConversionListener(org.activiti.workflow.simple.converter.listener.WorkflowDefinitionConversionListener) BpmnAutoLayout(org.activiti.bpmn.BpmnAutoLayout) Process(org.activiti.bpmn.model.Process) SimpleWorkflowException(org.activiti.workflow.simple.exception.SimpleWorkflowException) BpmnModel(org.activiti.bpmn.model.BpmnModel)

Example 2 with WorkflowDefinitionConversionListener

use of org.activiti.workflow.simple.converter.listener.WorkflowDefinitionConversionListener in project Activiti by Activiti.

the class WorkflowDefinitionConversionFactory method initDefaultWorkflowDefinitionConversionListeners.

protected void initDefaultWorkflowDefinitionConversionListeners() {
    List<WorkflowDefinitionConversionListener> listeners = new ArrayList<WorkflowDefinitionConversionListener>();
    listeners.add(new DefaultWorkflowDefinitionConversionListener());
    setDefaultWorkflowDefinitionConversionListeners(listeners);
}
Also used : WorkflowDefinitionConversionListener(org.activiti.workflow.simple.converter.listener.WorkflowDefinitionConversionListener) DefaultWorkflowDefinitionConversionListener(org.activiti.workflow.simple.converter.listener.DefaultWorkflowDefinitionConversionListener) DefaultWorkflowDefinitionConversionListener(org.activiti.workflow.simple.converter.listener.DefaultWorkflowDefinitionConversionListener) ArrayList(java.util.ArrayList)

Aggregations

WorkflowDefinitionConversionListener (org.activiti.workflow.simple.converter.listener.WorkflowDefinitionConversionListener)2 ArrayList (java.util.ArrayList)1 BpmnAutoLayout (org.activiti.bpmn.BpmnAutoLayout)1 BpmnModel (org.activiti.bpmn.model.BpmnModel)1 Process (org.activiti.bpmn.model.Process)1 DefaultWorkflowDefinitionConversionListener (org.activiti.workflow.simple.converter.listener.DefaultWorkflowDefinitionConversionListener)1 SimpleWorkflowException (org.activiti.workflow.simple.exception.SimpleWorkflowException)1