private WorkflowModel getWorkflowModelFromDataStore(String workflowId, boolean includeTasks) {
        WorkflowModel workflow = executionDAO.getWorkflow(workflowId, includeTasks);
        if (workflow == null) {
            LOGGER.debug("Workflow {} not found in executionDAO, checking indexDAO", workflowId);
            String json = indexDAO.get(workflowId, RAW_JSON_FIELD);
            if (json == null) {
                String errorMsg = String.format("No such workflow found by id: %s", workflowId);
                LOGGER.error(errorMsg);
                throw new NotFoundException(errorMsg);
            }

            try {
                workflow = objectMapper.readValue(json, WorkflowModel.class);
                if (!includeTasks) {
                    workflow.getTasks().clear();
                }
            } catch (IOException e) {
                String errorMsg = String.format("Error reading workflow: %s", workflowId);
                LOGGER.error(errorMsg);
                throw new TransientException(errorMsg, e);
            }
        }
        return workflow;
    }
Fetches the {@link Workflow} object from the data store given the id. Attempts to fetch from
{@link ExecutionDAO} first, if not found, attempts to fetch from {@link IndexDAO}.

@param workflowId the id of the workflow to be fetched
@param includeTasks if true, fetches the {@link Task} data in the workflow.
@return the {@link Workflow} object
@throws NotFoundException no such {@link Workflow} is found.
@throws TransientException parsing the {@link Workflow} object fails.
core/src/main/java/com/netflix/conductor/core/dal/ExecutionDAOFacade.java