if (paramList != null)
{
int nParams = paramList.size();
for (int i = 0; i < nParams; ++i)
{
NodeParam param = (NodeParam) paramList.get(i);
String expression = param.getExpression();
if (expression != null)
{
// Evaluate the expression before checking the parameters
if (ScriptUtil.isConstantExpression(expression))
{
// Evaluate constant expressions only if we do not yet have a parameter value
Object value = TokenContextUtil.getParamValue(context, param);
if (value == null)
{
value = ScriptUtil.getConstantExpressionValue(expression);
if (value != null)
{
// Finally, we have a value. Assign it to to the parameter
TokenContextUtil.setParamValue(context, param, value);
}
}
}
else
{
// Evaluate a script expression
ScriptEngine scriptEngine = engine.getScriptEngineFactory().obtainScriptEngine(context);
try
{
// Evaluate the expression
scriptEngine.prepareNodeParamExecution(param);
Object value = scriptEngine.executeScript(expression, "exit parameter script", param.getQualifier().toString());
scriptEngine.finishNodeParamExecution(param);
// Assign the result to the parameter
TokenContextUtil.setParamValue(context, param, value);
}