use of io.automatiko.engine.api.expression.ExpressionEvaluator in project automatiko-engine by automatiko-io.
the class JqReturnValueEvaluator method evaluate.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Object evaluate(ProcessContext context) throws Exception {
ExpressionEvaluator evaluator = (ExpressionEvaluator) ((WorkflowProcess) context.getProcessInstance().getProcess()).getDefaultContext(ExpressionEvaluator.EXPRESSION_EVALUATOR);
Map<String, Object> vars = new HashMap<>();
vars.put("workflowdata", context.getVariable(JsonVariableScope.WORKFLOWDATA_KEY));
if (context.getVariable("$CONST") != null) {
vars.put("workflow_variables", Collections.singletonMap("CONST", context.getVariable("$CONST")));
}
Object content = evaluator.evaluate(expression, vars);
if (content == null) {
return false;
}
if (content instanceof BooleanNode) {
return ((BooleanNode) content).asBoolean();
}
return false;
}
Aggregations