WorkflowInstanceDao { public WorkflowInstance getWorkflowInstance(long id, Set<WorkflowInstanceInclude> includes, Long maxActions) { String sql = "select * from nflow_workflow where id = ?"; WorkflowInstance instance = jdbc.queryForObject(sql, new WorkflowInstanceRowMapper(), id).build(); if (includes.contains(WorkflowInstanceInclude.CURRENT_STATE_VARIABLES)) { fillState(instance); } if (includes.contains(WorkflowInstanceInclude.CHILD_WORKFLOW_IDS)) { fillChildWorkflowIds(instance); } if (includes.contains(WorkflowInstanceInclude.ACTIONS)) { fillActions(instance, includes.contains(WorkflowInstanceInclude.ACTION_STATE_VARIABLES), maxActions); } return instance; } @Inject  WorkflowInstanceDao(SQLVariants sqlVariants, @NFlow JdbcTemplate nflowJdbcTemplate,
      @NFlow TransactionTemplate transactionTemplate, @NFlow NamedParameterJdbcTemplate nflowNamedParameterJdbcTemplate,
      ExecutorDao executorDao, WorkflowInstanceExecutor workflowInstanceExecutor, WorkflowInstanceFactory workflowInstanceFactory,
      Environment env); long insertWorkflowInstance(WorkflowInstance instance); @SuppressWarnings("null") void updateWorkflowInstanceAfterExecution(WorkflowInstance instance, WorkflowInstanceAction action,
      List<WorkflowInstance> childWorkflows, List<WorkflowInstance> workflows, boolean createAction); int updateWorkflowInstance(WorkflowInstance instance); void recoverWorkflowInstancesFromDeadNodes(); void checkStateVariableValueLength(String name, String value); boolean updateNotRunningWorkflowInstance(WorkflowInstance instance); boolean wakeUpWorkflowExternally(long workflowInstanceId, List<String> expectedStates); boolean wakeupWorkflowInstanceIfNotExecuting(long workflowInstanceId, List<String> expectedStates); WorkflowInstance getWorkflowInstance(long id, Set<WorkflowInstanceInclude> includes, Long maxActions); List<Long> pollNextWorkflowInstanceIds(final int batchSize); List<WorkflowInstance> queryWorkflowInstances(QueryWorkflowInstances query); Stream<WorkflowInstance> queryWorkflowInstancesAsStream(QueryWorkflowInstances query); @Transactional(propagation = MANDATORY) long insertWorkflowInstanceAction(final WorkflowInstance instance, final WorkflowInstanceAction action); long insertWorkflowInstanceAction(final WorkflowInstanceAction action); String getWorkflowInstanceState(long workflowInstanceId); Optional<Integer> getSignal(long workflowInstanceId); @Transactional boolean setSignal(long workflowInstanceId, Optional<Integer> signal, String reason, WorkflowActionType actionType); String getWorkflowInstanceType(long workflowInstanceId);  }
@Test public void queryNonExistingWorkflowThrowsException() { assertThrows(EmptyResultDataAccessException.class, () -> dao.getWorkflowInstance(-42, emptySet(), null) ); }