cancel
Showing results for 
Search instead for 
Did you mean: 

epressionManager property in ProcessEngineConfiguration

ptriller
Champ in-the-making
Champ in-the-making
Hello,

I am trying to give the Tasks in the engine a few context services which I can call from scripts and ELExpression,

for this I set an expressionManager inmy activity.cfg.xml

but after debuggingaround in the code a bit, I saw, that the manager is not used,

Is this italways uses the createElContext method of the JuelScriptEngine and not from my provided expressionManager


Any hints on what I should do ?



Peter
6 REPLIES 6

frederikherema1
Star Contributor
Star Contributor
Hi,

The expression-manager is only used for resolving 'Expressions'. The Scripting uses another mechanism to introduce variables to the script-context, the Bindings (org.activiti.engine.impl.scripting.ExecutionBindings).

These bindings are created "ScriptEngines", and currently don't have an easy access-point to add custom things, related issues:
http://jira.codehaus.org/browse/ACT-97
http://jira.codehaus.org/browse/ACT-438

ptriller
Champ in-the-making
Champ in-the-making
thanks for your quick answer.

Any workaround you can think of, so I can call service methods in Juel ?

If I use groovy scripts in Script Tasks, I can just use static methods, so that is managable,
but Juel does not allow that IIRC, so putting the result of some mehtod calls
in Forms is not possible, I just want to put some live status into the form
of a user task which is obtained by a service call.

Any idea ?

frederikherema1
Star Contributor
Star Contributor
Hi,

Only workaround I can think of is this:
You can plug in your own FormEngine (pointer on this here: http://forums.activiti.org/en/viewtopic.php?f=6&t=759&p=3305&hilit=formengine#p3305).

Your form-engine should use ScriptEngineManager instead of the Activiti ScriptEngines (take a look in the ScriptEngines.evaluate()), this way you can pass custom "bindings" including your services you want to expose. Offcourse, this way you bypass the activiti way of evaluating scripts, and just use JSR-223.

Hope this helps

ptriller
Champ in-the-making
Champ in-the-making
Ok, thanks, maybe I'll look into that later,

for now I will just inject a serializable "context" java class into the process that wraps the service calls I need
with an execution listener. Not the most elegant solution, but it works.

frederikherema1
Star Contributor
Star Contributor
Smuggling services in using a Serializable? Sneaky Smiley Wink

tombaeyens
Champ in-the-making
Champ in-the-making
I will be revisiting this and your request should be tackled in this release.