use of io.automatiko.engine.workflow.base.instance.ContextableInstance in project automatiko-engine by automatiko-io.
the class TaskInputJqAssignmentAction method execute.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void execute(WorkItem workItem, ProcessContext context) throws Exception {
Object sdata = context.getVariable(JsonVariableScope.WORKFLOWDATA_KEY);
ExpressionEvaluator evaluator = (ExpressionEvaluator) ((WorkflowProcess) context.getProcessInstance().getProcess()).getDefaultContext(ExpressionEvaluator.EXPRESSION_EVALUATOR);
Map<String, Object> vars = new HashMap<>();
vars.put("workflowdata", sdata);
if (context.getVariable("$CONST") != null) {
vars.put("workflow_variables", Collections.singletonMap("CONST", context.getVariable("$CONST")));
}
if (inputFilterExpression != null) {
sdata = evaluator.evaluate(inputFilterExpression, vars);
}
if (context.getNodeInstance() instanceof ContextableInstance) {
VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((ContextableInstance) context.getNodeInstance()).getContextInstance(VariableScope.VARIABLE_SCOPE);
variableScopeInstance.setVariable(JsonVariableScope.WORKFLOWDATA_KEY, sdata);
}
if (paramNames != null && !paramNames.isEmpty()) {
vars = new HashMap<>();
vars.put("workflowdata", sdata);
if (context.getVariable("$CONST") != null) {
vars.put("workflow_variables", Collections.singletonMap("CONST", context.getVariable("$CONST")));
}
for (String name : paramNames) {
Object param = workItem.getParameter(name);
if (param != null) {
param = evaluator.evaluate(param.toString(), vars);
((WorkItemImpl) workItem).setParameter(name, param);
}
}
} else {
((WorkItemImpl) workItem).setParameter("Parameter", sdata);
}
}
use of io.automatiko.engine.workflow.base.instance.ContextableInstance in project automatiko-engine by automatiko-io.
the class InputJqAssignmentAction method execute.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void execute(WorkItem workItem, ProcessContext context) throws Exception {
Object sdata = context.getProcessInstance().getVariable(JsonVariableScope.WORKFLOWDATA_KEY);
if (inputFilterExpression != null) {
ExpressionEvaluator evaluator = (ExpressionEvaluator) ((WorkflowProcess) context.getProcessInstance().getProcess()).getDefaultContext(ExpressionEvaluator.EXPRESSION_EVALUATOR);
Map<String, Object> vars = new HashMap<>();
vars.put("workflowdata", sdata);
if (context.getVariable("$CONST") != null) {
vars.put("workflow_variables", Collections.singletonMap("CONST", context.getVariable("$CONST")));
}
sdata = evaluator.evaluate(inputFilterExpression, vars);
}
if (context.getNodeInstance() instanceof ContextableInstance) {
VariableScopeInstance variableScopeInstance = (VariableScopeInstance) ((ContextableInstance) context.getNodeInstance()).getContextInstance(VariableScope.VARIABLE_SCOPE);
variableScopeInstance.setVariable(JsonVariableScope.WORKFLOWDATA_KEY, sdata);
}
}
Aggregations