<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic JUEL Exception evaluating variables with punctuation in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/juel-exception-evaluating-variables-with-punctuation/m-p/235634#M188764</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've encountered an issue when setting a juel conditionExpression that contains a period '.'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My sequence flow looks like this: [extract from the model]&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;sequenceFlow id="sid-DF4F1F47-4C84-45BE-BF9F-C297DFDC88D3" name="approved" sourceRef="sid-6C005338-CA27-4D4E-B969-BA2410284FFE" targetRef="doapproved"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;conditionExpression xsi:type="tFormalExpression"&amp;gt;&amp;lt;![CDATA[${global.response == allow}]]&amp;gt;&amp;lt;/conditionExpression&amp;gt;&lt;BR /&gt;&amp;lt;/sequenceFlow&amp;gt;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'global.response' is our own internal namespace name - it's just a variable key.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The salient extract of exception stackTrace I get when the exclusiveGateway that the above sequenceFlow is connected to 'leave's is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt; ..lots of trace..&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;Caused by: org.activiti.engine.ActivitiException: Unknown property used in expression: ${global.response == allow}&lt;BR /&gt;.&lt;BR /&gt;'&lt;BR /&gt;..lots more irrelevant trace..&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'global'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.juel.AstBinary$SimpleOperator.eval(AstBinary.java:27)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.juel.AstBinary.eval(AstBinary.java:106)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.juel.AstBinary$SimpleOperator.eval(AstBinary.java:27)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.juel.AstBinary.eval(AstBinary.java:106)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I had a look at this, half-expecting it to point me to some BeanELContext or similar, but the exception is in the AstBinary evaluator, for which there is no matching AstBinary$SimpleOperator that I can see in the source for a period .&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Some javadoc in the Activiti EL evaluators talk about coercing to an Integer or otherwise ignoring. Is there a way to evaluate a processVariable as a String value? - i.e. in sequence flows: 'if this variable is the String "approve" follow this sequence flow'..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking at the JUEL spec, it implies that . is used for beans, but then shows examples where regular names are used that contain '.', so the spec is inconclusive in this area.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, JUEL doesn't let you 'escape' anything except ${ and #{ &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(I did try this, but I got this exception:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Caused by: org.activiti.engine.impl.juel.TreeBuilderException: Error parsing '${global\.response == allow}': lexical error at position 8, encountered invalid character '\', expected expression token&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So..the question is, how to put a period '.' in a sequenceFlow conditionExpression without the evaluator thinking it's something other than simply a period?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In fact, apart from the obvious operator types ( + - &amp;amp; | / etc.) is it possible to include punctuation (i.e. non-alpahnumeric and non-reserved characters)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks for any insights,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;+Peter&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Sep 2016 23:01:06 GMT</pubDate>
    <dc:creator>midiman</dc:creator>
    <dc:date>2016-09-23T23:01:06Z</dc:date>
    <item>
      <title>JUEL Exception evaluating variables with punctuation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/juel-exception-evaluating-variables-with-punctuation/m-p/235634#M188764</link>
      <description>Hi,I've encountered an issue when setting a juel conditionExpression that contains a period '.'My sequence flow looks like this: [extract from the model]&amp;lt;sequenceFlow id="sid-DF4F1F47-4C84-45BE-BF9F-C297DFDC88D3" name="approved" sourceRef="sid-6C005338-CA27-4D4E-B969-BA2410284FFE" targetRef="doap</description>
      <pubDate>Fri, 23 Sep 2016 23:01:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/juel-exception-evaluating-variables-with-punctuation/m-p/235634#M188764</guid>
      <dc:creator>midiman</dc:creator>
      <dc:date>2016-09-23T23:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: JUEL Exception evaluating variables with punctuation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/juel-exception-evaluating-variables-with-punctuation/m-p/235635#M188765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A SOLUTION!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So although the exception is showing AstBinary, the real culprit is the original suspect: the bean resolver (to be fair, this is well documented in the User Guide under Expressions)…so…for anyone encountering this problem, here's the way I solved it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added a bean id to my socflow.cfg.xml, that points to a simple bean resolver class, passing the DelegateExecution and the key.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So the sequenceFlow xml looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sequenceFlow id="sid-DF4F1F47-4C84-45BE-BF9F-C297DFDC88D3" name="approved" sourceRef="sid-6C005338-CA27-4D4E-B969-BA2410284FFE" targetRef="doapproved"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;conditionExpression xsi:type="tFormalExpression"&amp;gt;&amp;lt;![CDATA[${global.resolve('global.response', execution) == 'approve'}]]&amp;gt;&amp;lt;/conditionExpression&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/sequenceFlow&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My bean id looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;bean id="global" class="package.where.your.resolover.lives.NamespaceResolver" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And my bean looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;package package.where.your.resolover.lives;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import java.io.*;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import org.activiti.engine.delegate.*;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;public class NamespaceResolver implements Serializable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; public CNamespaceResolver() {}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; public Object resolve(String key, DelegateExecution execution)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; /*&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; This will return an Object. When comparing in UEL, you'll need to know it's a String - see the single-quotes 'approve'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; return execution.getVariable(key); &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Doing it this way allows JUEL to stay happy and evaluate 'string' values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Peter&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 23:47:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/juel-exception-evaluating-variables-with-punctuation/m-p/235635#M188765</guid>
      <dc:creator>midiman</dc:creator>
      <dc:date>2016-09-23T23:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: JUEL Exception evaluating variables with punctuation</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/juel-exception-evaluating-variables-with-punctuation/m-p/235636#M188766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Peter!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use execution.getVariable("global.response") in JUEL expression, there's no need to derive new bean in this case .&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2016 11:34:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/juel-exception-evaluating-variables-with-punctuation/m-p/235636#M188766</guid>
      <dc:creator>warper</dc:creator>
      <dc:date>2016-09-26T11:34:51Z</dc:date>
    </item>
  </channel>
</rss>

