cancel
Showing results for 
Search instead for 
Did you mean: 

JUEl and Spring activiti engine configuration

hell_keeper
Champ in-the-making
Champ in-the-making
Hello, is it possible to configure the JUEL engine inside the activiti engine with a full spring configuration ?

For my workflow I need to have a JUEL engine which acceptes null values. JUEL documentation  precises that the propertie : "javax.el.nullProperties" should be set to our need.

But how can we set this propertie with a org.activiti.spring.SpringProcessEngineConfiguration or org.activiti.spring.ProcessEngineFactoryBean ?

Thanks for your replies.
10 REPLIES 10

trademak
Star Contributor
Star Contributor
We are not using the default JUEL engine inside the Activiti, but instead use a modified version with a similar syntax. The implementation can be found in org.activiti.engine.impl.javax.el.BeanELResolver for the most part. Can you show in a code example what you are achieving to do with the null values support?

Best regards,

hell_keeper
Champ in-the-making
Champ in-the-making
In fact I would have the same behaviour as EL in a JSP page. For example :  when ${foo} is used and the foo variable isn't set I prefer to have a null value than an PropertyNotFoundException.

I know it's possible to delegate the behaviour to a JAVA class but The workflow is "big" and I prefer the first solution than modify each part that needs this behaviour.

Edit : this stack trace may help you to illustrate my need,

Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'escalationNeeded'
at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
at org.activiti.engine.impl.juel.AstUnary$SimpleOperator.eval(AstUnary.java:28)
at org.activiti.engine.impl.juel.AstUnary.eval(AstUnary.java:60)
at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)
… 97 more

Like in JSP EL, I would like that the unknown field "escalationNeeded" is null than get an exception. The main goal of this is to be able to test  "${!escalationNeeded}" like ${escalationNeeded==null || !escalationNeeded} (or something similar to test if the variable exists or not).

trademak
Star Contributor
Star Contributor
Okay that makes sense. Could you create a JIRA for this?

Best regards,

hell_keeper
Champ in-the-making
Champ in-the-making
Ok but I can't log in into your JIRA server (I don't  have any access to and I don't find the administrator contact to request an account).

sebastian_s
Champ in-the-making
Champ in-the-making
To create JIRA issues for Activiti you have to create an account for JIRA at Codehaus. Creating an account for JIRA there is not directly possible. Instead you have to sign up here:

https://xircles.codehaus.org/signup/

hell_keeper
Champ in-the-making
Champ in-the-making
Thanks for your help. I have created a ticket : http://jira.codehaus.org/browse/ACT-1667

osilva
Champ in-the-making
Champ in-the-making
Hi Activiti team,

After the initial rush for setting up my workflow I'm looking back and wondering if there's a cleaner way to inject property values loaded by the SpringPropertyPlaceholderConfigurer …

E.g. to externalize the duration for a timer

Since some of the expressions I tried to refer to the properties didn't work I ended up with a [n ugly?] workaround defining a spring bean as a map with key,value entries where I configured -an indirection to- a subset of the properties loaded by spring that I need "within" activiti.  The juel expression to this bean is successfully resolved.

Thanks,

Omar

PS: below, some snippets illustrating my solution/workaround

<code>
    <!– ugly workaround, activiti doesn t seem to resolve properties from PropertyPlaceholderConfigurer –>
    <util:map id="activitiProps">
        <entry key="emailTo" value="${notification.email.recipients}"/>
        <entry key="emailFrom" value="${email.sender}"/>
        <entry key="peTimeout" value="${workflow.timeout.minutes:60}"/>
    </util:map>

    <boundaryEvent id="boundarytimer1" name="Timer" attachedToRef="calculationDone" cancelActivity="false">
      <timerEventDefinition>
        <timeDuration>PT${activitiProps.peTimeout}M</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>

        <activiti:field name="from">
          <activiti:expression>${activitiProps.emailFrom}</activiti:expression>
        </activiti:field>
<code>

jbarrez
Star Contributor
Star Contributor
Activiti indeed doesn't resolve properties from PropertyPlaceholderConfigurer. But it would be nice if it would though, I think the expression manager would need to be made a bit smarter and integrate better with the Spring expression manager.

gokceng1
Champ in-the-making
Champ in-the-making
Hello Joram,
We are using Activiti 5.14 and creating el.properties file seems to be not working.
I've overridden [java]org.activiti.engine.impl.juel.ExpressionFactoryImpl[/java] to support [java]javax.el.nullProperties[/java] property but I wonder whether a better way to do this exists.
Thank you.