public WorkflowDefinition getWorkflowDefinition(String workflowId, String version) {
    if (IdHelper.isInlineWorkflowId(workflowId)) {
      return getInlineWorkflowDefinitionInternal(workflowId);
    } else {
      return getMaestroWorkflowInternal(workflowId, version).toDefinition();
    }
  }
@Test
  public void testGetWorkflowDefinition() throws Exception {
    WorkflowDefinition wfd = loadWorkflow(TEST_WORKFLOW_ID1);
    assertEquals(TEST_WORKFLOW_ID1, wfd.getWorkflow().getId());
    workflowDao.addWorkflowDefinition(wfd, wfd.getPropertiesSnapshot().extractProperties());
    assertNotNull(wfd.getInternalId());
    WorkflowDefinition definition =
        workflowDao.getWorkflowDefinition(wfd.getWorkflow().getId(), "latest");
    assertNotNull(definition.getInternalId());
    assertEquals(wfd, definition);
    assertEquals(TEST_WORKFLOW_ID1, definition.getMetadata().getWorkflowId());
    assertEquals(1L, definition.getMetadata().getWorkflowVersionId().longValue());

    definition = workflowDao.getWorkflowDefinition(wfd.getWorkflow().getId(), "default");
    assertNotNull(definition.getInternalId());
    assertEquals(wfd, definition);
    assertEquals(TEST_WORKFLOW_ID1, definition.getMetadata().getWorkflowId());
    assertEquals(1L, definition.getMetadata().getWorkflowVersionId().longValue());

    definition = workflowDao.getWorkflowDefinition(wfd.getWorkflow().getId(), "active");
    assertNotNull(definition.getInternalId());
    assertEquals(wfd, definition);
    assertEquals(TEST_WORKFLOW_ID1, definition.getMetadata().getWorkflowId());
    assertEquals(1L, definition.getMetadata().getWorkflowVersionId().longValue());

    definition = workflowDao.getWorkflowDefinition(wfd.getWorkflow().getId(), "1");
    assertNotNull(definition.getInternalId());
    assertEquals(wfd, definition);
    assertEquals(TEST_WORKFLOW_ID1, definition.getMetadata().getWorkflowId());
    assertEquals(1L, definition.getMetadata().getWorkflowVersionId().longValue());
  }