cancel
Showing results for 
Search instead for 
Did you mean: 

Property in JUEL Expression

stroobat
Champ in-the-making
Champ in-the-making
I'm creating a subprocess that accepts some parameters. One of the first steps in my subprocess is to check the presense of the paremeters.
If they are not present I'm ending the subprocess (the parent process will take over).

Here is the xml:

   
   <process id="resubmitOrder">

        <exclusiveGateway id="checkParameters" name="checkParameters"/>

        <sequenceFlow id="resubmitFlow_1" sourceRef="startResubmitOrder" targetRef="checkParameters"/>
        <sequenceFlow id="resubmitFlow_2" sourceRef="checkParameters" targetRef="endResubmitOrder">
            <conditionExpression xsi:type="tFormalExpression">${orderId==null or subOrderId==null}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="resubmitFlow_3" sourceRef="checkParameters" targetRef="correctOrder">
            <conditionExpression xsi:type="tFormalExpression">${orderId != null and subOrderId != null}</conditionExpression>
        </sequenceFlow>
        <sequenceFlow id="resubmitFlow_4" sourceRef="correctOrder" targetRef="endResubmitOrder"/>

        <endEvent id="endResubmitOrder" name="endResubmitOrder" />

   </process>

When running this code in a unit test, I get the exception

org.activiti.engine.ActivitiException: Unknown property used in expression
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:46)
   at org.activiti.engine.impl.el.UelExpressionCondition.evaluate(UelExpressionCondition.java:36)
   at org.activiti.engine.impl.bpmn.ExclusiveGatewayActivityBehavior.leave(ExclusiveGatewayActivityBehavior.java:62)

Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'orderId'

I could also use a servicetask to check on the parameters … But then I have to put the code in a Java class. Just wanted to configure it in xml.
Is that possible ?

I could do this justing JSTL (which is nullpointer friendly).

Tom.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
Is it a embedded subprocess or a call activity?

For call activities special care is needed to pass variables: see section 'passing variables' in userguide http://activiti.org/userguide/index.html#bpmnCallActivity

stroobat
Champ in-the-making
Champ in-the-making
Yes, I understand, and I am able to pass variables.

But as a subprocess, I don't know who is calling me, and I expect certain parameters to be passed to me.
That's why I wanted to check if the calling process has passed all the parameter I'm expecting.

If for instance I'm expecting an orderId (in the subprocess) and I want to check for it like this:


        <sequenceFlow id="resubmitFlow_2" sourceRef="checkParameters" targetRef="endResubmitOrder">
            <conditionExpression xsi:type="tFormalExpression">${orderId==null or subOrderId==null}</conditionExpression>
        </sequenceFlow>

So suppose that the orderId was not passed by the calling process I want to take some action …
But if the orderId is not passed the above XML will throw an exception saying orderId was not found.

Tom.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
But if the orderId is not passed the above XML will throw an exception saying orderId was not found.

It is hard to return anything else since 'null' can be a valid value as can ''. So throwing an error in EL is the only option. What you can do e.g. in this case isnot use it directly, but implement a java service task that checks them, catches the error and sets another property that can be used in the condition.