ExplorerApp.get().getViewManager().showEditorProcessDefinitionPage(model.getId());
}
protected WorkflowDefinition createWorkflow() {
WorkflowDefinition workflow = new WorkflowDefinition();
workflow.setName((String) nameField.getValue());
String description = (String) descriptionField.getValue();
if (description != null && description.length() > 0) {
workflow.setDescription(description);
}
List<HumanStepDefinition> steps = taskTable.getSteps();
for (int i=0; i<steps.size(); i++) {
HumanStepDefinition currentStep = steps.get(i);
// Check if we have a parallel block
int nextIndex = i+1;
ParallelStepsDefinition parallelStepsDefinition = null;
while (nextIndex < steps.size() && steps.get(nextIndex).isStartsWithPrevious()) {
if (parallelStepsDefinition == null) {
parallelStepsDefinition = new ParallelStepsDefinition();
ListStepDefinition<ParallelStepsDefinition> listStepDef = new ListStepDefinition<ParallelStepsDefinition>();
listStepDef.addStep(currentStep);
parallelStepsDefinition.addStepList(listStepDef);
}
ListStepDefinition<ParallelStepsDefinition> listStepDef = new ListStepDefinition<ParallelStepsDefinition>();
listStepDef.addStep(steps.get(nextIndex));
parallelStepsDefinition.addStepList(listStepDef);
nextIndex++;
}
if (parallelStepsDefinition != null) {
workflow.addStep(parallelStepsDefinition);
i = nextIndex - 1;
} else {
workflow.addStep(currentStep);
}
}
return workflow;
}