4 Replies Latest reply on Sep 5, 2011 2:45 PM by Maciej Swiderski

    JBPM5 EL Expression

    Donald Walters Newbie

      In the documentation I see that for contraints the supproted expression languages are Java and MVEL. Is there any reason why EL (or groovy, beanshell) was not used also? If I need to use one of these where should I start in order to override?


      The reason is that all my current JBPM4 processes use EL and I want to keep it like that.



        • 1. Re: JBPM5 EL Expression
          Maciej Swiderski Master

          Goof point Donald. I would expect to have EL available. Looks like a great opportunity for contribution


          So, I think a good place to start is to implement and interface of  org.jbpm.process.builder.dialect.ProcessDialect and then add it to org.jbpm.process.builder.dialect.ProcessDialectRegistry. That would be the first steps, I hope...


          Next is to make it visible for the processes and that would depend on where you would like to have EL support, for instance to have it available in Script Task you should add language support in SctiptTaskHandler inside handleNode method, similar to what is done for Java.


          That would be initial work to add support of EL. It is not comprehensive guideline but just a starting point.

          1 of 1 people found this helpful
          • 2. Re: JBPM5 EL Expression
            Donald Walters Newbie

            Hi Maciej,


            Based on your advice above I was able to make an implementation. This only works for condition expressions at the moment. But, I have been having an issue with the registration and usage of the dialect.


            below is how I register it. This is done just before creating the KnoledgeBase

            ProcessDialectRegistry.setDialect("jexl", new ELProcessDialect());


            The xml is as follows:

            <sequenceFlow id="case15" sourceRef="decision8" targetRef="prompt9">

                        <conditionExpression xsi:type="tFormalExpression" language="jexl"> ${response['resultSet'] != null &amp;&amp; response['resultSet'][0][0] &gt; 0}      </conditionExpression>



            But this does not work.


            If do the following it works perfectly.

            ProcessDialectRegistry.setDialect("mvel", new ELProcessDialect());


            The xml is as follows:

            <sequenceFlow id="case15" sourceRef="decision8" targetRef="prompt9">

                        <conditionExpression xsi:type="tFormalExpression"> ${response['resultSet'] != null &amp;&amp; response['resultSet'][0][0] &gt; 0}      </conditionExpression>



            I realize that from the core xml parser there are some checks for languages and anything other than java, xpath, rule then there is an exception.

            With some assistance I would be able to make the correct implementation and also for node support.


            Attached is source.

            note: I used the Apache Commons JEXL 2.0.1 library

            • 3. Re: JBPM5 EL Expression
              Donald Walters Newbie

              Hi Maciej,


              I did not get any feedback on the reply. Appreciate the help.



              • 4. Re: JBPM5 EL Expression
                Maciej Swiderski Master

                Donald, apologies for late reply. I've been quite busy and then forgot to answer... anyway


                If it comes to the issue you're facing now I think the only way is to enhance already existing code to support another expression language or do it just for your cases. Regarding the first one you have already found the place:

                modify SequenceFlowHandler's end method to include your language of choice while parsing the BPMN2 constructs.


                The other one is to:

                • implement your own handler (that could extend SequenceFlowHandler)
                • implement SemanticModule (that extends BPMNSemanticModule) that will put your new handler in the right place instead of the default one
                • implement BPMNProcessProvider that will setup all semantic modules that should be used while working on BPMN processes
                • last part is to register your new provider on BPMN2ProcessFactory


                Hope that gives you some alternatives but unfortunately I did not have enough time to verify all the statements...


                In my opinion you could go for the first one and modify core code base so others could benefit from your work


                Good luck