@VisibleForTesting
    boolean evaluateCondition(WorkflowModel workflow, TaskModel task) throws ScriptException {
        TaskDef taskDefinition = task.getTaskDefinition().orElse(null);
        // Use paramUtils to compute the task input
        Map<String, Object> conditionInput =
                parametersUtils.getTaskInputV2(
                        task.getWorkflowTask().getInputParameters(),
                        workflow,
                        task.getTaskId(),
                        taskDefinition);
        conditionInput.put(task.getReferenceTaskName(), task.getOutputData());
        List<TaskModel> loopOver =
                workflow.getTasks().stream()
                        .filter(
                                t ->
                                        (task.getWorkflowTask()
                                                        .has(
                                                                TaskUtils
                                                                        .removeIterationFromTaskRefName(
                                                                                t
                                                                                        .getReferenceTaskName()))
                                                && !task.getReferenceTaskName()
                                                        .equals(t.getReferenceTaskName())))
                        .collect(Collectors.toList());

        for (TaskModel loopOverTask : loopOver) {
            conditionInput.put(
                    TaskUtils.removeIterationFromTaskRefName(loopOverTask.getReferenceTaskName()),
                    loopOverTask.getOutputData());
        }

        String condition = task.getWorkflowTask().getLoopCondition();
        boolean result = false;
        if (condition != null) {
            LOGGER.debug("Condition: {} is being evaluated", condition);
            // Evaluate the expression by using the Nashorn based script evaluator
            result = ScriptEvaluator.evalBool(condition, conditionInput);
        }
        return result;
    }
Check if all tasks in the current iteration have reached terminal state.

@param doWhileTaskModel The {@link TaskModel} of DO_WHILE.
@param referenceNameToModel Map of taskReferenceName to {@link TaskModel}.
@return true if all tasks in DO_WHILE.loopOver are in <code>referenceNameToModel</code> and
    reached terminal state.
core/src/main/java/com/netflix/conductor/core/execution/tasks/DoWhile.java