cancel
Showing results for 
Search instead for 
Did you mean: 

Process variables xml only

mhw
Champ in-the-making
Champ in-the-making
Hi,

I am working on replacing our proprietary engine, which is configured by xml only. There I need a call to a java service. Then the result should be evaluated to continue.

I tried the following:
       variables.put("ServiceDelegate", new ServiceDelegate());
<serviceTask id="javaService" name="Read voltage"
      activiti:expression="#{ServiceDelegate.readVoltage()}"
      activiti:resultVariable="voltage">
      <extensionElements>
         <activiti:field name="serviceName">
            <activiti:string>READ_VOLTAGE</activiti:string>
         </activiti:field>
      </extensionElements>
   </serviceTask>
   <sequenceFlow id="flow2" sourceRef="exclusiveGw" targetRef="theTask1">
      <conditionExpression xsi:type="tFormalExpression">{voltage == 12.1}</conditionExpression>
    </sequenceFlow>
But it says: "condition expression returns non-Boolean". Why? I cannot find a complete reference to the expression language. Could someone please give me a hint?

I can't figure out how I pass the execution to the service, too(just like with "activiti:class"). How this is done using the expressions?

regards, Michael
7 REPLIES 7

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
the expression language used is JUEL which is mentioned in the docs: http://www.activiti.org/userguide/index.html#apiExpressions

mhw
Champ in-the-making
Champ in-the-making
the expression language used is JUEL which is mentioned in the docs: http://www.activiti.org/userguide/index.html#apiExpressions
Ok, yes. Thanks for the answer. From the EE6 spec I cannot answer this questions:

1) The example in the user guide is: ${myBean.doSomething(myVar, execution)}
so for my case I try: activiti:expression="${ServiceDelegate.execute(execution)}
This leads to a null pointer because the execution is null. Why is this? How can I pass the execution?

2) I have activiti:resultVariable="voltage"
Why this fails:
<conditionExpression xsi:type="tFormalExpression">{voltage == 12.1}</conditionExpression>with:
org.activiti.engine.ActivitiException: condition expression returns non-Boolean: {voltage == 12.1} (java.lang.String)
regards, Michael

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
I assume you have tried things like:
- surrounding strings with single quotes (if they are strings)
- correcting the expression so that it is a valid expression that requires some evaluation instead of being interpreted as a string (as the error mentions)
- Tried setting the debug level of activiti to a higher level and see what actually takes place?

option 2 is the solution btw  I think.

mhw
Champ in-the-making
Champ in-the-making

- correcting the expression so that it is a valid expression that requires some evaluation instead of being interpreted as a string (as the error mentions)
- Tried setting the debug level of activiti to a higher level and see what actually takes place?

option 2 is the solution btw  I think.

Thank you. You are right, I accidentally deleted the "$"-sign. Now the expression gets evaluated. The return value is used. Fine. For anybody interested, here is the spec of JULE(was not easy to find):
http://download.oracle.com/otndocs/jcp/expression_language-2.2-mrel-oth-JSpec/

I am still stuck with my first question: How is the execution object passed? How can I read this:
<activiti:field name="serviceName">
            <activiti:string>READ_VOLTAGE</activiti:string>
         </activiti:field>
in my service?

regards, Michael

jbarrez
Star Contributor
Star Contributor
The execution object should be usable just there. I can't find an example in your posts where I can see the exact expression you are using to try inject the execution…

mhw
Champ in-the-making
Champ in-the-making
The execution object should be usable just there. I can't find an example in your posts where I can see the exact expression you are using to try inject the execution…
Thank you for your answer. I understand now how to pass the execution object. The "real" question for us is:
What can we do to name the result variable of an service as an editor?
http://forums.activiti.org/en/viewtopic.php?f=6&t=2401

Best regards,
Michael

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
please use now topics for new questions