-
1. Re: JBPM5 EL Expression
swiderski.maciej Aug 4, 2011 3:02 PM (in response to dondragon2)1 of 1 people found this helpfulGoof 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.
-
2. Re: JBPM5 EL Expression
dondragon2 Aug 27, 2011 10:29 PM (in response to swiderski.maciej)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 && response['resultSet'][0][0] > 0} </conditionExpression>
</sequenceFlow>
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 && response['resultSet'][0][0] > 0} </conditionExpression>
</sequenceFlow>
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
-
Archive.zip 6.9 KB
-
-
3. Re: JBPM5 EL Expression
dondragon2 Sep 5, 2011 8:18 AM (in response to dondragon2)Hi Maciej,
I did not get any feedback on the reply. Appreciate the help.
Donald
-
4. Re: JBPM5 EL Expression
swiderski.maciej Sep 5, 2011 2:45 PM (in response to dondragon2)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
Maciej