public WorkflowDef getWorkflowDef(String name, Integer version) {
        Optional<WorkflowDef> workflowDef;
        if (version == null) {
            workflowDef = metadataDAO.getLatestWorkflowDef(name);
        } else {
            workflowDef = metadataDAO.getWorkflowDef(name, version);
        }

        return workflowDef.orElseThrow(
                () ->
                        new NotFoundException(
                                "No such workflow found by name: %s, version: %d", name, version));
    }
@param name Name of the workflow to retrieve
@param version Optional. Version. If null, then retrieves the latest
@return Workflow definition
core/src/main/java/com/netflix/conductor/service/MetadataServiceImpl.java