public DeciderOutcome decide ( Workflow workflow ) throws TerminateWorkflowException { //In case of a new workflow the list of tasks will be empty. final List < Task > tasks = workflow . getTasks ( ) ; // Filter the list of tasks and include only tasks that are not executed, // not marked to be skipped and not ready for rerun. // For a new workflow, the list of unprocessedTasks will be empty List < Task > unprocessedTasks = tasks . stream ( ) . filter ( t -> ! t . getStatus ( ) . equals ( SKIPPED ) && ! t . getStatus ( ) . equals ( READY_FOR_RERUN ) && ! t . isExecuted ( ) ) . collect ( Collectors . toList ( ) ) ; List < Task > tasksToBeScheduled = new LinkedList <> ( ) ; if ( unprocessedTasks . isEmpty ( ) ) { //this is the flow that the new workflow will go through tasksToBeScheduled = startWorkflow ( workflow ) ; if ( tasksToBeScheduled == null ) { tasksToBeScheduled = new LinkedList <> ( ) ; } } return decide ( workflow , tasksToBeScheduled ) ; }
QQ public method validation of the input params