use of org.camunda.bpm.engine.impl.javax.el.VariableMapper in project camunda-bpm-platform by camunda.
the class JuelScriptEngine method createElContext.
private ELContext createElContext(final ScriptContext scriptCtx) {
// Check if the ELContext is already stored on the ScriptContext
Object existingELCtx = scriptCtx.getAttribute("elcontext");
if (existingELCtx instanceof ELContext) {
return (ELContext) existingELCtx;
}
scriptCtx.setAttribute("context", scriptCtx, ScriptContext.ENGINE_SCOPE);
// Built-in function are added to ScriptCtx
scriptCtx.setAttribute("out:print", getPrintMethod(), ScriptContext.ENGINE_SCOPE);
SecurityManager securityManager = System.getSecurityManager();
if (securityManager == null) {
scriptCtx.setAttribute("lang:import", getImportMethod(), ScriptContext.ENGINE_SCOPE);
}
ELContext elContext = new ELContext() {
ELResolver resolver = createElResolver();
VariableMapper varMapper = new ScriptContextVariableMapper(scriptCtx);
FunctionMapper funcMapper = new ScriptContextFunctionMapper(scriptCtx);
@Override
public ELResolver getELResolver() {
return resolver;
}
@Override
public VariableMapper getVariableMapper() {
return varMapper;
}
@Override
public FunctionMapper getFunctionMapper() {
return funcMapper;
}
};
// Store the elcontext in the scriptContext to be able to reuse
scriptCtx.setAttribute("elcontext", elContext, ScriptContext.ENGINE_SCOPE);
return elContext;
}
Aggregations