<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Re: Transition rule EL Expression fails [Solved]
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/milnauf">milnauf</a> in <i>jBPM</i> - <a href="http://community.jboss.org/message/583448#583448">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello,</p><p>I running into problems when I try evaluating an expression during runtime (yeah - using internal APIs&#160; :s ). What I'm doing is essentially try to find possible execution path using transition's condition.<br/>The problem is that the method org.jbpm.pvm.internal.model.ExpressionCondition.evaluate(OpenExecution execution) - invokes evaluate() on created expression - rather than evaluate(execution). The problem is that the execution variables are not found - because in the subsequent call to JbpmElFactoryImpl.createCompositeResolver - if the scopeInstance is null - which it is in this case - the JbpmVariableElResolver is not added.</p><p>So a cosmetic change of the org.jbpm.pvm.internal.model.ExpressionCondition evaluate to invoke evaluate with execution parameter rather than without it - should fix the problem. Unless of course there's a good reason for not passing current execution.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>At the bottom I attach a stacktrace for the error that I'm getting -&gt; resulting directly from not using the OpenExecution to evaluate the expression.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The resulting code would be similar to the below:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public class org.jbpm.pvm.internal.model.ExpressionCondition {</p><p>public boolean evaluate(OpenExecution execution) {</p><p>&#160;&#160;&#160; Object result = Expression.create(expression, language).evaluate(execution);</p><p>&#160;&#160;&#160; if (result instanceof Boolean) {</p><p>&#160;&#160;&#160;&#160;&#160; return ((Boolean) result).booleanValue();</p><p>&#160;&#160;&#160; }</p><p>&#160;&#160;&#160; throw new JbpmException("expression condition '" + expression + "' did not return a boolean: "+result);</p><p>&#160; }</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160; ... </p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Stack trace:</p><p>javax.el.PropertyNotFoundException: Cannot resolve identifier 'task1'</p><p>&#160;&#160;&#160; at de.odysseus.el.tree.impl.ast.AstIdentifier.eval(AstIdentifier.java:86)</p><p>&#160;&#160;&#160; at de.odysseus.el.tree.impl.ast.AstEval.eval(AstEval.java:51)</p><p>&#160;&#160;&#160; at de.odysseus.el.tree.impl.ast.AstNode.getValue(AstNode.java:28)</p><p>&#160;&#160;&#160; at de.odysseus.el.TreeValueExpression.getValue(TreeValueExpression.java:122)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.el.UelValueExpression.evaluateInScope(UelValueExpression.java:52)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.el.Expression.evaluate(Expression.java:108)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.model.ExpressionCondition.evaluate(ExpressionCondition.java:41)</p><p>&#160;&#160;&#160; at com.wfi.base.service.util.WorkItemQuery.findFutureItemNames(WorkItemQuery.java:59)</p><p>&#160;&#160;&#160; at com.wfi.base.service.util.WorkItemQuery.findFutureItemNames(WorkItemQuery.java:63)</p><p>&#160;&#160;&#160; at com.wfi.base.service.util.WorkItemQuery.execute(WorkItemQuery.java:50)</p><p>&#160;&#160;&#160; at com.wfi.base.service.util.WorkItemQuery.execute(WorkItemQuery.java:1)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:50)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)</p><p>&#160;&#160;&#160; at org.jbpm.pvm.internal.processengine.ProcessEngineImpl.execute(ProcessEngineImpl.java:300)</p><p>&#160;&#160;&#160; at com.wfi.ec.workflow.WorkflowService.findCurrentWorkItem(WorkflowService.java:303)</p><p>&#160;&#160;&#160; at com.wfi.ec.workflow.WorkflowServiceTest.testFutureSteps(WorkflowServiceTest.java:392)</p><p>&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</p><p>&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</p><p>&#160;&#160;&#160; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</p><p>&#160;&#160;&#160; at java.lang.reflect.Method.invoke(Method.java:597)</p><p>&#160;&#160;&#160; at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)</p><p>&#160;&#160;&#160; at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)</p><p>&#160;&#160;&#160; at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)</p><p>&#160;&#160;&#160; at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)</p><p>&#160;&#160;&#160; at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)</p><p>&#160;&#160;&#160; at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)</p><p>&#160;&#160;&#160; at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)</p><p>&#160;&#160;&#160; at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)</p><p>&#160;&#160;&#160; at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)</p><p>&#160;&#160;&#160; at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)</p><p>&#160;&#160;&#160; at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)</p><p>&#160;&#160;&#160; at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)</p><p>&#160;&#160;&#160; at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)</p><p>&#160;&#160;&#160; at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)</p><p>&#160;&#160;&#160; at org.junit.runners.ParentRunner.run(ParentRunner.java:236)</p><p>&#160;&#160;&#160; at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)</p><p>&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)</p><p>&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)</p><p>&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)</p><p>&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)</p><p>&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/583448#583448">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>