use of org.camunda.bpm.engine.impl.javax.el.ELResolver in project camunda-bpm-platform by camunda.
the class DefaultElResolverLookup method lookupResolver.
public static final ELResolver lookupResolver(AbstractProcessApplication processApplication) {
ServiceLoader<ProcessApplicationElResolver> providers = ServiceLoader.load(ProcessApplicationElResolver.class);
List<ProcessApplicationElResolver> sortedProviders = new ArrayList<ProcessApplicationElResolver>();
for (ProcessApplicationElResolver provider : providers) {
sortedProviders.add(provider);
}
if (sortedProviders.isEmpty()) {
return null;
} else {
// sort providers first
Collections.sort(sortedProviders, new ProcessApplicationElResolver.ProcessApplicationElResolverSorter());
// add all providers to a composite resolver
CompositeELResolver compositeResolver = new CompositeELResolver();
StringBuilder summary = new StringBuilder();
summary.append(String.format("ElResolvers found for Process Application %s", processApplication.getName()));
for (ProcessApplicationElResolver processApplicationElResolver : sortedProviders) {
ELResolver elResolver = processApplicationElResolver.getElResolver(processApplication);
if (elResolver != null) {
compositeResolver.add(elResolver);
summary.append(String.format("Class %s", processApplicationElResolver.getClass().getName()));
} else {
LOG.noElResolverProvided(processApplication.getName(), processApplicationElResolver.getClass().getName());
}
}
LOG.paElResolversDiscovered(summary.toString());
return compositeResolver;
}
}
use of org.camunda.bpm.engine.impl.javax.el.ELResolver in project camunda-bpm-platform by camunda.
the class AbstractElResolverDelegate method getValue.
public Object getValue(ELContext context, Object base, Object property) {
context.setPropertyResolved(false);
ELResolver delegate = getElResolverDelegate();
if (delegate == null) {
return null;
} else {
return delegate.getValue(context, base, property);
}
}
use of org.camunda.bpm.engine.impl.javax.el.ELResolver in project camunda-bpm-platform by camunda.
the class AbstractElResolverDelegate method isReadOnly.
public boolean isReadOnly(ELContext context, Object base, Object property) {
context.setPropertyResolved(false);
ELResolver delegate = getElResolverDelegate();
if (delegate == null) {
return true;
} else {
return delegate.isReadOnly(context, base, property);
}
}
use of org.camunda.bpm.engine.impl.javax.el.ELResolver 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