AnsweredAssumed Answered

Access to expressionManager from EngineServices?

Question asked by tstephen on Jan 22, 2014
Latest reply on May 2, 2016 by psc1952
Hi,

Since the mail service task has the body of the mail injected as fields (named html and text) it is not possible to modify that body elsewhere in the process. There are several use cases for this including:

  • using a template stored externally in an ECM ; and
  • using different templates for different languages.
I thought a simple answer would be to allow two more fields (htmlVar and textVar) that will hold the name of a process variable that will be populated with the template. Note that I still want to be able to embed ${processVariable}s in these templates and have them replaced by the service task.

This is all working fine but I have not found an 'official' way to access the expression manager so for now I have to cast the EngineServices to the implementation class as shown below.


    public void execute(ActivityExecution execution) {
      …
      ProcessEngineConfigurationImpl svcs = (ProcessEngineConfigurationImpl) execution.getEngineServices();
      ExpressionManager em = svcs.getExpressionManager();


Obviously this is pretty dirty so I wondered how you feel about exposing the expressionManager on the EngineServices interface? Or is there some other way that would be better to get one?

cheers,
Tim

Outcomes