use of com.walmartlabs.concord.runtime.v2.runner.compiler.CompilerContext in project concord by walmartlabs.
the class IfCompiler method compile.
@Override
public Command compile(CompilerContext context, IfStep step) {
Command thenCommand = compile(context, step.getThenSteps());
Command elseCommand = compile(context, step.getElseSteps());
return new IfCommand(step, thenCommand, elseCommand);
}
use of com.walmartlabs.concord.runtime.v2.runner.compiler.CompilerContext in project concord by walmartlabs.
the class SwitchCompiler method compile.
@Override
public Command compile(CompilerContext context, SwitchStep step) {
List<Map.Entry<String, Command>> caseCommands = new ArrayList<>();
for (Map.Entry<String, List<Step>> kv : step.getCaseSteps()) {
caseCommands.add(new AbstractMap.SimpleEntry<>(kv.getKey(), compile(context, kv.getValue())));
}
Command defaultCommand = compile(context, step.getDefaultSteps());
return new SwitchCommand(step, caseCommands, defaultCommand);
}
use of com.walmartlabs.concord.runtime.v2.runner.compiler.CompilerContext in project concord by walmartlabs.
the class GroupOfStepsCompiler method compile.
@Override
public Command compile(CompilerContext context, GroupOfSteps step) {
Command cmd = compile(context, step.getSteps());
GroupOfStepsOptions options = Objects.requireNonNull(step.getOptions());
WithItems withItems = options.withItems();
if (withItems != null) {
return WithItemsWrapper.of(cmd, withItems, options.out(), Collections.emptyMap());
}
Loop loop = options.loop();
if (loop != null) {
cmd = LoopWrapper.of(context, cmd, loop, options.out(), Collections.emptyMap());
}
List<Step> errorSteps = options.errorSteps();
if (!options.errorSteps().isEmpty()) {
cmd = new ErrorWrapper(cmd, compile(context, errorSteps));
}
return cmd;
}
Aggregations