I created a small test to see if this works and it partly seems to... The expression is being recognized but once it should be actually parse, an error is thrown:
org.jbpm.api.JbpmException: no scripting engine configured for language uel
at org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:111)
at org.jbpm.pvm.internal.script.ScriptManager.evaluateExpression(ScriptManager.java:88)
at org.jbpm.pvm.internal.el.ScriptExpression.evaluateInScope(ScriptExpression.java:45)
at org.jbpm.pvm.internal.el.Expression.evaluate(Expression.java:102)
at org.jbpm.pvm.internal.expr.UelExpressionTest.testUelExpression(UelExpressionTest.java:56)
Testcase:
import org.jbpm.pvm.activities.WaitState;
import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
import org.jbpm.pvm.internal.el.Expression;
import org.jbpm.pvm.internal.el.ScriptExpression;
import org.jbpm.pvm.internal.el.UelValueExpression;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.test.JbpmTestCase;
public class ExpressionTest extends JbpmTestCase {
public void testUelExpression() {
ExecutionImpl execution = (ExecutionImpl) ProcessDefinitionBuilder
.startProcess()
.startActivity("initial", new WaitState())
.initial()
.endActivity()
.endProcess()
.startProcessInstance();
execution.setVariable("pv", "MyTest");
Expression expression = Expression.create("#
{pv}", Expression.LANGUAGE_UEL_VALUE);
UelValueExpression uve = ((UelValueExpression) expression);
assertEquals("MyTest", uve.evaluate(execution));
Expression expression = Expression.create("#{pv}
", Expression.LANGUAGE_UEL);
ScriptExpression se = ((ScriptExpression) expression);
assertEquals("MyTest", se.evaluate(execution));
}
}
The first one (UEL_VALUE) works and the second (UEL) not. I cannot seem to find the reason why there is no scripting engine. The way the second expression is constructed is the same as is done for the description. So I tried changing this in the parser (UEL ->UEL_VALUE) and the description could be parsed to (full test of task with description is attached)
Index: src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
— src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java (revision 6150)
+++ src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java (working copy)
@@ -493,7 +493,7 @@
Element descriptionElement = XmlUtil.element(element, "description");
if (descriptionElement!=null)
{
String descriptionText = XmlUtil.getContentText(descriptionElement);
- Expression descriptionExpression = Expression.create(descriptionText, Expression.LANGUAGE_UEL);
+ Expression descriptionExpression = Expression.create(descriptionText, Expression.LANGUAGE_UEL_VALUE);
assignableDefinition.setDescription(descriptionExpression);
}
Fixes the problem...
Any ideas?
I use Ronald's code to create a patch. After change LANGUAGE_UEL to LANGUAGE_UEL_VALUE the testcase could run successfully, but this issue depended on
JBPM-1209, and that issue have last more than two years. I don't know whenJBPM-1209could finished, and whether it will affect this issue.