brainslug.flow.execution.impl.ChoiceNodeExecutor Maven / Gradle / Ivy
package brainslug.flow.execution.impl;
import brainslug.flow.execution.ExecutionContext;
import brainslug.flow.model.ChoiceDefinition;
import brainslug.flow.model.FlowNodeDefinition;
import brainslug.flow.model.ThenDefinition;
import java.util.ArrayList;
import java.util.List;
public class ChoiceNodeExecutor extends DefaultNodeExecutor {
@Override
public List execute(ChoiceDefinition choiceDefinition, ExecutionContext execution) {
List next = new ArrayList();
for (ThenDefinition thenPath : choiceDefinition.getThenPaths()) {
if (execution.getBrainslugContext().getPredicateEvaluator().evaluate(thenPath.getPredicateDefinition(), execution)) {
next.add(thenPath.getPathNodes().get(1));
return next;
}
}
return next;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy