inst.setSharedContext(sharedContext);
// now read all of the workflow info
Workflow workflow = new Workflow();
workflow.setId(doc.get("workflow_id"));
workflow.setName(doc.get("workflow_name"));
workflow.setTasks(toTasks(doc));
workflow.setConditions(toConditions("workflow_condition_"+workflow.getId(), doc));
inst.setWorkflow(workflow);
return inst;
}