<?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 Re: conditionExpression - how to access static methods in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/conditionexpression-how-to-access-static-methods/m-p/205508#M158638</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&amp;gt; Would be great if activiti could support the JSR-223 script engines to be used for conditionExpression as well… just like for script tasks. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; However I couldn't find something about that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No it does not support that. I do like the idea …&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Apr 2015 08:27:21 GMT</pubDate>
    <dc:creator>jbarrez</dc:creator>
    <dc:date>2015-04-21T08:27:21Z</dc:date>
    <item>
      <title>conditionExpression - how to access static methods</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/conditionexpression-how-to-access-static-methods/m-p/205506#M158636</link>
      <description>Hi there!I'd like to use a static method call inside a conditional expression of my sequence flow. Is there any way to import classes to the juel expression context? As far as I see, this context just knows about process variables and spring beans. Therefore I get an ActivitiException telling me: "U</description>
      <pubDate>Mon, 20 Apr 2015 09:02:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/conditionexpression-how-to-access-static-methods/m-p/205506#M158636</guid>
      <dc:creator>zhn</dc:creator>
      <dc:date>2015-04-20T09:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: conditionExpression - how to access static methods</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/conditionexpression-how-to-access-static-methods/m-p/205507#M158637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I worked on this problems for a couple of hours now and somehow solved it for my use case. Actually I couldn't find a point to access the ELContext of juel. However I found a workaround by implementing a service bean that wraps the expression evaluation. We do not use juel anymore but forward to a javax EL 3.0 glassfish implementation. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe someone also wants to use this solution as well. So here's what our conditionExpression now looks like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;sequenceFlow id="checkSalary" sourceRef="1234" targetRef="4321"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;conditionExpression xsi:type="tFormalExpression"&amp;gt;${javaxEL.eval("#{Money.less(salary, Money.valueOf(\"1500 EUR\")}", execution)}&amp;lt;/conditionExpression&amp;gt;&lt;BR /&gt;&amp;lt;/sequenceFlow&amp;gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;My service bean (id="javaxEL") just forwards the evaluation to javax EL 3.0 glassfish implementation. The execution property point to the current variable scope:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;public class ActivitiJavaxELConnector {&lt;BR /&gt;&amp;nbsp; public Object eval(String expr, VariableScope scope) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ExpressionFactory factory = ExpressionFactory.newInstance();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELContext context = new StandardELContext(factory);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // import packages&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.getImportHandler().importPackage("de.myexample.valuetypes");&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // add variables to context&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (Entry&amp;lt;String, Object&amp;gt; v : scope.getVariables().entrySet()) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.getELResolver().setValue(context, null, v.getKey(), v.getValue());&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // evaluate&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return factory.createValueExpression(context, expr, Object.class).getValue(context);&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;Haven't tested this for all use cases. Probably beans now cannot be used within the forwarded expression. However we don't use that in a conditionExpressions normally. Maybe this is not the smartest solution but it just works for us… &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would be great if activiti could support the JSR-223 script engines to be used for conditionExpression as well… just like for script tasks. However I couldn't find something about that. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best, Christin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2015 12:48:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/conditionexpression-how-to-access-static-methods/m-p/205507#M158637</guid>
      <dc:creator>zhn</dc:creator>
      <dc:date>2015-04-20T12:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: conditionExpression - how to access static methods</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/conditionexpression-how-to-access-static-methods/m-p/205508#M158638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&amp;gt; Would be great if activiti could support the JSR-223 script engines to be used for conditionExpression as well… just like for script tasks. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; However I couldn't find something about that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No it does not support that. I do like the idea …&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Apr 2015 08:27:21 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/conditionexpression-how-to-access-static-methods/m-p/205508#M158638</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2015-04-21T08:27:21Z</dc:date>
    </item>
  </channel>
</rss>

