use of com.walmartlabs.concord.runtime.v2.model.SetVariablesStep in project concord by walmartlabs.
the class SetVariablesCommand method execute.
@Override
@SuppressWarnings("unchecked")
protected void execute(Runtime runtime, State state, ThreadId threadId) {
state.peekFrame(threadId).pop();
SetVariablesStep step = getStep();
Context ctx = runtime.getService(Context.class);
// eval the input
ExpressionEvaluator ee = runtime.getService(ExpressionEvaluator.class);
Map<String, Object> vars = ee.evalAsMap(EvalContextFactory.scope(ctx), step.getVars());
vars.forEach((k, v) -> {
Object o = ctx.variables().get(k);
if (o instanceof Map && v instanceof Map) {
v = deepMerge((Map<String, Object>) o, (Map<String, Object>) v);
}
ctx.variables().set(k, v);
});
}
Aggregations