AnsweredAssumed Answered

conditionExpression - how to access static methods

Question asked by zhn on Apr 20, 2015
Latest reply on Apr 21, 2015 by jbarrez
Hi there!

I'd like to use a static method call inside a conditional expression of my sequence flow. Is there any way to import classes to the juel expression context?
As far as I see, this context just knows about process variables and spring beans. Therefore I get an ActivitiException telling me: "Unknown property used in expression".

Let me explain my use case:
We have a couple of custom value types, e.g. "Money". Selecting a value, is done by calling a static valueOf-method like:
Money.valueOf("50 EUR")
. In addition the Money class provides some static methods for comparing and calculating values.

In my process I need to use an exclusive gateway checking some process variables of type Money:

<sequenceFlow id="checkSalary" sourceRef="1234" targetRef="4321">
    <conditionExpression xsi:type="tFormalExpression">${Money.less(salary, Money.valueOf("1500 EUR")}</conditionExpression>
The process variable "salary" is set before reaching this sequence flow. It should be compared to the value of 1500 EUR. "less" and "valueOf" are static methods of my java class "Money". The method "less" returns a Boolean.

Even if I'm changing the expression to
${Money.less(Money.valueOf("50 EUR", Money.valueOf("1500 EUR"))}
I'm getting the same exception. Thats absolutly clear… because the juel expression context does not know about my class Money. It just recons "Money" to be a property.

Is there a way to influence the ELContext of the JUEL to know about custom classes? Something like:

I can't find a point to access or configure this context.

Thanks and Best regards!