Some refactoring needed to set up a generation workflow using QueryJ's built-in flow, but without QueryJ-specific database context. refs #418