Hi,
We have a custom expression manager that evaluates expressions defined in the bpmn process using ejb’s. As you may know, when you ask the container to give you a reference to the class, it returns a proxy of that class. We apply this behavior when resolving ServiceTasks, TaskListeners, ExecutionListeners and EventListers implementation at runtime.
Because our implementation returns a proxy of that class, Flowable cannot automatically inject expressions in the class since it cannot find the fields or setters using reflection.
To resolve this issue, we use org.flowable.engine.delegate.DelegateHelper to fetch the field expression when the bean is actually being executed, like for example:
<process id="process" name="My process" isExecutable="true">
<startEvent id="startNoneEvent1" flowable:initiator="initiator" flowable:formFieldValidation="false"/>
<sequenceFlow id="sequenceFlow2" sourceRef="startNoneEvent1" targetRef="serviceTask1"/>
<serviceTask id="serviceTask1" name="Service task" flowable:delegateExpression="${myServiceTaskBean}">
<extensionElements>
<flowable:field name="event">
<flowable:string><![CDATA[CALL_SOMETHING]]></flowable:string>
</flowable:field>
</extensionElements>
</serviceTask>
<endEvent id="endNoneEvent2"/>
<sequenceFlow id="sequenceFlow3" sourceRef="serviceTask1" targetRef="endNoneEvent2"/>
</process>
@Stateless(name = "myServiceTaskBean")
@TransactionManagement(TransactionManagementType.BEAN)
public class MyServiceTask implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) {
String event = (String) DelegateHelper.getFieldExpression(execution, "event").getValue(execution);
// event = "CALL_SOMETHING";
}
}
This works fine and hasn’t given us problems.
Now we’re starting to use CMMN and a new problem arises: how do we do we apply this type of behavior for the CMMN context, more specifically using org.flowable.cmmn.api.delegate.DelegatePlanItemInstance ? The DelegateHelper only has methods working with org.flowable.engine.delegate.DelegateExecution and org.flowable.task.service.delegate.DelegateTask.
Do you know if there is any other helper class to achive what we need?